Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed the latest php version on my mountain lion system using these instructions ( I even put /usr/local/bin first in my path variable, so when I run php -v at the command line I get php v5.4.x The problem is that when I run a simple script (with the phpinfo() function inside) the page tells me that I am running the old 5.3.x php version that comes pre-installed with mac os mountain lion. I even tried to restart apache, but the problem remains. Any ideas on this one? Thank you.

share|improve this question
Depending on your needs, you could try XAMPP: I find it a lot easier to configure and run than OS X's Apache/PHP combo. – Vidar Ramdal Oct 11 '12 at 13:56
up vote 3 down vote accepted

That tutorial you followed is a bit dangerous. It seems it tells you to replace the default X11 with a new one, which is a really bad unnecessary idea.

Where did you change your local variable? If you used .profile or .bash_profile it is only valid for your user. To affect all users you need to change /etc/paths. But I don't think it has anything to do with the PATH var.

Regarding your question, this means Apache is not loading the correct PHP module. (

Check the creation date of /usr/libexec/apache2/

If it predates your build time, then it was not replaced.

  1. First turn off Apache (either in Settings or by running sudo apachectl stop in the console).

  2. Then rename /usr/libexec/apache2/ -->sudo mv /usr/libexec/apache2/ /usr/libexec/apache2/

  3. Then go to the source dir and run make install. (if you have deleted the directory, the makefile or ran make clean you will need to start the compilation process again)

  4. Then check if exists at /usr/libexec/apache2/. If it does not exist, then your compilation parameters are wrong. If it does, go to step 5.

  5. Rename the new /usr/libexec/apache2/ to (or the version you're installing).

  6. Backup httpd.conf --> sudo cp /usr/libexec/apache2/httpd.conf /usr/libexec/apache2/httpd.conf.bak

  7. Edit httpd.conf --> sudo nano /usr/libexec/apache2/httpd.conf and change LoadModule php5_module libexec/apache2/ to LoadModule php5_module libexec/apache2/

  8. Put the old back. --> sudo mv /usr/libexec/apache2/ /usr/libexec/apache2/

  9. Restart apache (in settings or with sudo apachectl start)

Let me know if it worked for you

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.