Apache/PHP installation on OSX differences?

20
2014-03
  • Upliftmike

    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
        phpinfo()
        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?

    Thanks,

  • Answers
  • heiglandreas

    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.


  • Related Question

    Installing PHP APC on Windows/Apache
  • Jiew Meng

    i need help installing and configuring PHP APC i have downloaded from http://downloads.php.net/pierre/ in my PHP info, i see

    Compiler MSVC9 (Visual C++ 2008) Architecture x86

    so i downloaded php_apc-5.3-nts-svn20100226-vc9-x86.zip. then to install, i tried adding

    [PHP_APC]
    extension=php_apc.dll
    

    to php.ini. restarting Apache fails. trying to execute php in cmd results in an error saying php5.dll is missing. but i doubt so. removing the 2 lines from php.ini fixes the error. how can i install apc then?


  • Related Answers
  • Jiew Meng

    i finally managed to install apc with the help from here. i installed on IIS7

    added to end of php.ini

    [PHP_APC]
    extension=php_apc.dll
    
    apc.shm_segments=1
    apc.optimization=0
    apc.shm_size=128
    apc.ttl=7200
    apc.user_ttl=7200
    apc.num_files_hint=1024
    apc.mmap_file_mask=/tmp/apc.XXXXXX
    apc.enable_cli=1
    

    tho i got no idea what the configuration does