osx - How to upgrade PHP on Mac OS X

20
2014-03
  • user1692333

    So i did simple thing:

    php -i | head
    ./configure --prefix=/usr --with-snmp
    make
    sudo make install
    

    But phpinfo() still showing me 5.3.15. Here some results of investigations:

    • PHP_BINDIR = /usr/bin
    • phpversion() = 5.3.15
    • 192-168-0-100:$ /usr/bin/php -v
      PHP 5.4.8 (cli) (built: Nov 8 2012 09:30:58)
    • 192-168-0-100:$ /usr/local/bin/php -v
      PHP 5.4.8 (cli) (built: Nov 7 2012 22:09:56)
    • 192-168-0-100:$ which php
      /usr/bin/php

    Also tried plying with different ln -s. May be some suggestions?

    P.S. php is working fine on localhost, but it is still 5.3 (tried some new features from php 5.4)

  • Answers
  • slhck

    Instead of building yourself and potentially wreaking havoc in your /bin directory—this might kill your original PHP installation—do yourself a favor and use prebuilt installations like those below.


    MAMP

    MAMP currently ships with PHP 5.2 and 5.4.4. It'll run standalone and you can switch anytime.

    MAMP is installed in the typical Mac fashion: very easily. MAMP will not compromise any existing Apache installation already running with your OS X. You can install Apache, PHP and MySQL without starting a script or having to change any configuration files!

     

    PHP Binary Packages

    You can also try the PHP 5.3/5.4 for OS X as binary packages:

    This package installs the (usually) latest PHP 5.3.x/5.4.x […] in /usr/local/php5. It installs many useful extensions […]. It also provides a decent php.ini with all settings configured according to "Best Practices".

    For PHP 5.4, installation is as easy as running:

    curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4
    

  • Related Question

    osx snow leopard - GUI for Apache/PHP on a Mac
  • Traveling Tech Guy

    Recently installed Snow Leopard on my Mac Mini. Something screwed up my Apache/PHP installation and it's now looking at a different library as localhost. The PHP installation also reset some of my earlier choices (i.e., turned of cURL, etc.).

    Now, I know I can go around playing with a bunch of *.conf and *.ini files, but I wanted to know if there's a GUI available to control all those choices (a-la IIS Management applet in Windows)? Preferably a free one - this is for personal use.

    Thanks!


  • Related Answers
  • Mike1980

    webmin will work with OS X, and has some apache configuration options in it, I'm not sure about PHP. A word of warning, it's not exclusively apache configuration there are lots of other system settings can be changed through webmin.

    I must admit, I don't use it myself but have heard good things about webmin.

    There are also some useful tools as part of OS X Server, but I'm guessing you're using regular OS X so they won't be available.

  • Arjan

    a GUI [..] a-la IIS Management applet in Windows

    Not an answer to your question, but especially when moving things from one server to another (like you kind of did when you installed Snow Leopard), or when taking things from a test machine to a production machine, I think you'll eventually love the configuration files.

    In the IIS management console there's all kind of settings on many different screens, or hidden behind some "Advanced" button. One cannot get an overview of all current settings. And even worse, with each new version of IIS (even with a Service Pack) a few defaults might change, which one will not notice unless going through all the screens and buttons.

    For Apache you can see and edit all settings in a few files.

    So, and I am not trying to be funny: a good text editor might be the best GUI you'll find!

    (I have written IIS configuration manuals that got outdated faster than I could create new screen captures; for Apache I'd just copy the relevant parts of some configuration files and that would be it.)

  • Area 51

    You should take a look at Zend Server Community Edition for the Mac. It's quite nice, and does everything through a clean GUI:

    http://www.zend.com/en/products/server-ce/