Installing PHP 5 on Mac OS X

Okay, so I have been running PHP 4 locally on my Mac OS 10.4, but I recently needed to upgrade to PHP 5. In addition, PHP 4 will no longer be supported after the end of this year. The installation instructions are the same as for PHP 4, which is not a big deal. I also installed libcurl, which is not included by default for some reason.

Why am I posting this here then? So I can reference it, whenever I need to recompile PHP again. I am installing new libs all the time, it seems like, so it helps to know what I have done each time so I can do it again the next time. This is the third or fourth time I have done this, so I won’t go into that much detail. If you need more details, look at my other posts.

For step one, download and unzip PHP 5. Then, open the folder and run configure, make and sudo make intall, like this.

./configure --prefix=/usr/local/apache2/php
--with-curl=/usr/local/src/curl-7.17.1
--with-zlib-dir=/usr/local/lib
--with-jpeg-dir=/usr/local/lib
--with-png-dir=/usr/local/lib
--with-gd --with-mysql=/usr/local/mysql
--with-apxs2=/usr/local/apache2/bin/apxs
make
sudo make install

Remember to change your file paths, if they are different than mine. Restart Apache, and you’re done!