To install PHP on Mac OS X Snow Leopard there are, just as with Apache, several options one could use. I’ve chosen the most simple setup that will get most PHP based applications running that we need for the mailserver and such. Please remember that this is the 32 bit mode installation which requires a 32 bit MySQL and Apache installations otherwise you will get compiler or runtime errors.
You can start by downloading the latest source archive from www.php.net. Extract the source archive into a directory and use the Terminal to execute the following commands.
./configure --prefix=/usr/local/php5 \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --sysconfdir=/etc \ --with-config-file-path=/etc \ --with-zlib \ --with-zlib-dir=/usr \ --with-openssl \ --without-iconv \ --enable-exif \ --enable-ftp \ --enable-mbstring \ --enable-mbregex \ --enable-sockets \ --with-mysql=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-apxs2=/usr/local/apache2/bin/apxs
To compile and install:
make sudo make install
After installation, please add the following lines to your ‘httpd.conf’ at the end.
AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps
Restart Apache and you’re ready to go.
As you might have seen from the ‘
./configure‘ settings, your ‘
php.ini‘ file will be located in ‘
If you need mcrypt or GD (graphics) look here.