your on the right track. but by default when apple sends out apache with its system php is turned off...
so you got to go to ~/etc/httpd/
heres a file link in case you dont got hidden files not showing
file://~/etc/httpd/ (right [ or control+click] and open in new window)
and open the httpd.conf file and search for
#LoadModule php4_module libexec/httpd/libphp4.so
rename with out # so its
LoadModule php4_module libexec/httpd/libphp4.so
now search for
#AddModule mod_php4.c
and rename without # so its
AddModule mod_php4.c
now since premission errors may occur not allowing you to say there sometimes so if it does save to desktop and move it there and save by authenticating it with admin name and password
go to sharing again and stop web sharing and then start it back up.
your test.php should now work.