I don't think you understand exactly how php works. First of all , it doesn't compile anything , it's interpreting your script and outputs HTML.
Second , from your description of the problem it looks like you misconfigured something or your scripts are badly written , in any case you need to read the installation and configuration of php and php module for apache , if you need to check that you php module is installed correctly you cand put a file in the DocumentRoot of your website with the content of, for example info.php and load it in your browser. If you see the php info page then at least you know that the php module for apache is installed correctly. And go from there, You'll also see the location of the php.ini you need to edit in order to make changes to your php environment.
Anyway , every OS does things differently so i can't say for OS X how to configure the php module for apache but you should have found that information on the site where you got the packages that you installed.
http://php.net/manual/en/install.macosx.php