Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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'm wanting to update the local version of PHP on my Mac.. i've been doing some digging and got a little confused.

If i run php -i from the terminal it says:

    $ php -i
    PHP Version => 5.3.15
    Configuration File (php.ini) Path => /etc
    Loaded Configuration File => 

I was sure i had 5.4 installed so ran phpinfo();

    PHP Version 5.4.5
    Loaded config file: /usr/local/php5/lib/php.ini

A problem i'm having is i can't seem to make any php.ini file work, i'm getting lots of

    Notice: Undefined index:

errors, so error reporting is too high, but no matter how many php.ini files i find and edit it's not taking effect..

I have no idea which version of PHP is being used or why there is two.

Is it possible to disable or remove one of them so i know exactly whats going on, and then i can update it to a newer version?


share|improve this question

migrated from Mar 22 '13 at 1:37

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

You have two PHP-installations on your Mac. One of them is the default OS-X php whos binary is located under /usr/bin/php and the other one seems to be a kind of the liip one-line installer which is located under /usr/local/php5

When you call php -i on the command-line the MacOS-X default php under /usr/bin is called. And when you run a phpinfo()-script your WebServer calls the apache-module of the PHP located under /usr/local/php5.

So when you want to remove one of your installations, I'd recommend removing the one under /usr/local/php5 as the otehr one is bundled with your OS and the files are located all over the filesystem and it's not that easy to get rid of everything related.

But if you want to upgrade your PHP installation you might simply call the one-line-installer from liip again which will install the new version in a new directory under /usr/local/ and link it against the /usr/local/php5-folder.

And if you want to call those new binaries you can either adapt your $PATH-Variable so that /usr/local/php5/bin comes before /usr/bin or you simply call it directly usig the full path to the binary like /usr/local/php5/bin/php -i.

share|improve this answer
Exactly the answer i was looking for, it all makes perfect sense now i've got the correct version showing on php -i and can also see php.ini changes. thanks :) – GoodBytes Mar 22 '13 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .