How do I upgrade PHP in Mac OS X?

thebossman picture thebossman · Mar 26, 2010 · Viewed 141k times · Source

I feel this is an awfully obtuse question to ask, but strangely, this problem is poorly documented.

I would like to upgrade PHP, but there are several problems:

  • There is no built-in package manager. MacPorts doesn't recognize php as an installed package because it didn't install PHP itself.
  • Running locate php indicates there are probably many dependencies.
  • I don't know HOW php was installed, as it was included with the OS, so I don't know whether I should install from source or download binaries. I also don't know the proper way to uninstall the previous version without breaking dependencies.

I am running on Leopard. I have a feeling Apple doesn't want you to upgrade. Would buying Snow Leopard and upgrade solve this problem (and future ones like it)?

Answer

Scott Saunders picture Scott Saunders · Mar 26, 2010

You may want to check out Marc Liyanage's PHP package. It comes in a nice Mac OS X installer package that you can double-click. He keeps it pretty up to date.

http://php-osx.liip.ch/

Also, although upgrading to Snow Leopard won't help you do PHP updates in the future, it will probably give you a newer version of PHP. I'm running OS X 10.6.2 and it has PHP 5.3.0.