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.
- 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 http://git.io/eUx7rg)
- Download and Install MacPorts for OS X 10.9 Mavericks (find other versions, more details on installing here)
- In terminal, run:
sudo port -d selfupdate
- 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 (instantclient-basic-macos.x64-22.214.171.124.0.zip,instantclient-sdk-macos.x64-126.96.36.199.0.zip) 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.)
- 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/libphp5.so Below it add : LoadModule php5_module /opt/local/apache2/modules/mod_php55.so
- 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*