PHP logoIf you have installed Lighttpd and wan’t PHP support you’ve come to the right page.I’ve chosen a simple setup that will get most PHP based applications running.

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. Please note the difference when having an Intel or PowerPC based Mac:

For Intel:
CFLAGS=”-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk” \
./configure --prefix=/usr/local/php5x \
  --mandir=/usr/share/man \
  --infodir=/usr/share/info \
  --sysconfdir=/etc \
  --with-zlib \
  --with-xml \
  --with-zlib-dir=/usr \
  --with-openssl \
  --enable-exif \
  --enable-ftp \
  --enable-mbstring \
  --enable-mbregex \
  --enable-sockets \
  --with-mysql=/usr/local/mysql \
  --with-mysqli=/usr/local/mysql/bin/mysql_config \
  --enable-fastcgi \
  --enable-discard-path \
  --enable-force-redirect

For PowerPC:
CFLAGS=”-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk” \
./configure --prefix=/usr/local/php5x \
  --mandir=/usr/share/man \
  --infodir=/usr/share/info \
  --sysconfdir=/etc \
  --with-zlib \
  --with-xml \
  --with-zlib-dir=/usr \
  --with-openssl \
  --enable-exif \
  --enable-ftp \
  --enable-mbstring \
  --enable-mbregex \
  --enable-sockets \
  --with-mysql=/usr/local/mysql \
  --with-mysqli=/usr/local/mysql/bin/mysql_config \
  --enable-fastcgi \
  --enable-discard-path \
  --enable-force-redirect

For both:
make
 
sudo make install

You will have noticed that I’ve choosen to install PHP5 in a different location (/usr/local/php5x), but that is because I’ve got Apache running on the same machine as well and that needs a different PHP installation.

We’ve already configured Lighttpd for this PHP install on the previous page so to try and start it and see if it all works for you.