Blog » Blog Entry

PHP 4 and 5 on MacOS X

August 7, 2006

Install latest Xcode and Macports (Darwinports) first.

Install PHP dependencies:

sudo port install \
  jpeg \
  libpng \
  freetype \
  tiff \
  XFree86 \
  gettext \
  xpm \
  libmcrypt \
  mhash

PHP 4:

./configure \
  --prefix=/usr/local/php4 \
  --with-config-file-path=/usr/local/php4/lib \
  --with-apxs=/usr/sbin/apxs \
  --with-curl \
  --with-gettext=/opt/local \
  --with-gd \
  --with-jpeg-dir=/opt/local \
  --with-png-dir=/opt/local \
  --with-freetype-dir=/opt/local \
  --with-tiff-dir=/opt/local \
  --with-xpm-dir=/opt/local \
  --with-zlib \
  --with-mysql=/usr/local/mysql \
  --with-mcrypt=/opt/local \
  --with-mhash=/opt/local \
  --enable-trans-sid \
  --enable-ftp \
  --enable-mbstring \
  --enable-sockets

make

sudo make install

PHP 5

./configure \
  --prefix=/usr/local/php5 \
  --with-config-file-path=/usr/local/php5/lib \
  --with-apxs=/usr/sbin/apxs \
  --with-curl \
  --with-gettext=/opt/local \
  --with-gd \
  --with-jpeg-dir=/opt/local \
  --with-png-dir=/opt/local \
  --with-freetype-dir=/opt/local \
  --with-tiff-dir=/opt/local \
  --with-xpm-dir=/opt/local \
  --with-zlib \
  --with-mysqli=/usr/local/mysql/bin/mysql_config \
  --with-mysql=/usr/local/mysql \
  --with-pdo-mysql=/usr/local/mysql \
  --with-mcrypt=/opt/local \
  --with-mhash=/opt/local \
  --enable-trans-sid \
  --enable-ftp \
  --enable-mbstring \
  --enable-sockets

make

sudo make install

PHP 5 Apache Include:

LoadModule php5_module libexec/httpd/libphp5.so
AddModule mod_php5.c
<IfModule mod_php5.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  <IfModule mod_dir.c>
    DirectoryIndex index.php index.html
  </IfModule>
</IfModule>

PHP 4 Apache Include:

LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c
<IfModule mod_php4.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  <IfModule mod_dir.c>
    DirectoryIndex index.php index.html
  </IfModule>
</IfModule>
Tags: php, mac

« script/breakpointer broken? MacOS X updatedb »

Add a comment:

Title:

Comment:

Name:

Email: