Table of Contents

php

Apache 2 Module and CLI PHP

My Preferred Libs

./configure \
	--prefix=/usr/local \
	--mandir=/usr/local/man \
	--infodir=/usr/local/info \
	--with-apxs2=/usr/local/apache2/bin/apxs \
	--with-curl=/usr/local \
	--enable-exif \
	--enable-ftp \
	--with-gd=/usr/local \
	--with-jpeg-dir=/usr/local \
	--with-png-dir=/usr/local \
	--with-zlib-dir=/usr/local \
	--with-freetype-dir=/usr/local \
	--with-mcrypt=/usr/local \
	--with-mysql=/usr/local/mysql \
	--with-mysqli=/usr/local/mysql/bin/mysql_config \
	--with-pdo-mysql=/usr/local/mysql \
	--with-libxml-dir=/usr/local \
	--enable-zip \
	--with-pgsql=/usr/local/pgsql \
	--with-pdo-pgsql=/usr/local/pgsql \
	--enable-mbstring

make

sudo make install

Leopard Update

:!:I had problems installing on Leopard with ld (when linking). The problem seems to be with libxml2. I installed my own libxml2, but Leopard has it's own. It seems like my headers were read, but it tried to link against Apple's older libraries. To fix it, do the following:

Trimmed down module version (no lib dependencies)

./configure --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info --with-apxs2=/usr/local/apache2/bin/apxs --disable-cli

make

sudo make install

post install configuration

The apache configuration files should automatically be modified. If not, make sure you have the following in httpd.conf:

# this line should already have been added by the php install process
LoadModule php5_module        modules/libphp5.so

# instead of this, add the lines in the following step to mime.types
# AddHandler php5-script php

Instead of the AddHandler line, add these lines to mime.types:

application/x-httpd-php			php phtml
application/x-httpd-php-source		phps

php.ini

If you want to control custom settings for php, create or edit php.ini in /usr/local/lib. If it doesn't exist, go into your php build directory and run this:

sudo cp php.ini-development /usr/local/lib/php.ini

enable debugging and error handling features

Installing PDFLib

  1. download PDFLib for Mac OSX from http://www.pdflib.com (at the time of this writing, the correct file name was PDFlib-7.0.3p5-MacOSX-10.5-Universal-php.dmg)
  2. open the disk image
  3. read up on the documentation (the doc folder)
  4. navigate to bind/php5/php-520 (read the install instructions, or continue with these steps if you are installing this exact version)
  5. create directory /usr/local/lib/php/extensions
  6. create directory /usr/local/lib/php/extensions/no-debug-non-zts-20060613
  7. copy the libpdf_php.so file to /usr/local/lib/php/extensions/no-debug-non-zts-20060613
  8. add the following to php.ini
    extension=libpdf_php.so
  9. start or restart apache, and check a phpinfo page to verify that the module has loaded

starting and testing php

Start or restart apache, make a php page with the following to test the installation and configuration:

<?php

echo phpinfo();

?>

More CGI Help

see php_cgi