Install Custom PHP on Mac Pro (10.9 Mavericks)

Installing your own version of PHP may be necessary because Apple provides 5.4 and does not have modules you may need, in my case iODBC.

I went with MacpPorts because I had the fewer issues.

Lets begin:

  1. Install OSX Server($20) and XCode from the app store or developer site for free. (Be sure you agree to terms too otherwise the compiler wont work. Use the Launcher to start XCode once and you will be prompted)
    I could have probably avoided spending 19.95 on the server but I wanted to use other services not from MacPorts. I also Installed/configured MySQL with this single line I found here

    bash <(curl -Ls

  2. Download and Install MacPorts for OS X 10.9 Mavericks (find other versions, more details on installing here)
  3. In terminal, run: 

    sudo port -d selfupdate

  4. I decided to go with current release of PHP: 5.5 sudo port install php55 php55-curl php55-imagick php55-intl php55-mbstring php55-mcrypt php55-iconv php55-ming php55-mysql php55-soap php55-sockets php55-sqlite php55-xdebug php55-zip php55-apache2handler php55-solr php55-pdflib php55-gd php55-ftp php55-excel php55-pear php55-posix php55-pspell php55-ssh2 php55-timezonedb php55-xsl php55-odbc +iodbc I also added php55-oracle to see if it works, it did after I signed up for an account to download instaclient 64bit from here and placed the zip archives (, in /opt/local/var/macports/distfiles/oracle-instantclient/ (You may need a different version depending updates of MacPorts so wait and you will be prompted with exact instructions when you do this.)
  5. If all goes well without errors, great time to enable the new PHP in Apache. In config file: /Library/Server/Web/Config/apache2/httpd_server_app.conf Comment line so it looks like this : #LoadModule php5_module libexec/apache2/ Below it add : LoadModule php5_module /opt/local/apache2/modules/
  6. If you received errors try to look at log files, correct probles or exclude php module that reported an issue and go back to step for after you run: sudo port uninstall php*