The onlyway I can think that this could be accomplished is by invoking the php file as a cgi, so the first thing you would want to do is compile PHP as a CGI.
Then you could use something like this in your test.cpp file
system("exec /usr/local/bin/php -q /home/test.php")
This should accomplish what you want.
Derek