I am running an Apache2/PHP5 web server on my Mac (Mountain Lion). When I upgraded from Lion to Mountain Lion, I lost my dev environment/configs. Whilst trying to set everything up, I have somehow borked my httpd or php.ini configuration (I think, anyway)… when I point my browser to my localhost, I get the infamous PHP error:
Fatal error: Cannot redeclare (some random function).
Regardless of the page I point it to, I get this. Prior to the loss of my web server settings, this was not happening, so I am confident that the files are okay and all syntax is good (the whole site consistently uses include_once and require_once also).
I think it has to do with my virtual host setup or working directory setup… I’ve tried a number of things, but no joy so far.
I am happy to provide any/all info that would be useful… I’m at my wit’s end on this. Any help or suggestions would be greatly appreciated.
In my particular case, it happened to be a bad vhosts setup. Once I fixed a kind of redirect issue there, it solved the problem.
Both of the other answers (and comments) supplied here are VERY good though, and should help anyone with similar issues in the future debug their code. Very rarely will you goof up like I did with vhosts and run into this problem (but not a ton of others). Big thank you to Ross Smith II, metal_fan and Jeffrey for their help in this!