search for in the  
<Compiling for OS X ServerInstallation on Windows systems>
Last updated: Thu, 19 May 2005

Compiling for MacOS X Client

The following instructions will help you install a PHP module for the Apache web server included in MacOS X. This version includes support for the MySQL and PostgreSQL databases. These instructions are graciously provided by Marc Liyanage.

Warning

Be careful when you do this, you could screw up your Apache web server!

Do this to install:

  1. Open a terminal window.

  2. Type wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz, wait for the download to finish.

  3. Type gunzip libphp4.so.gz.

  4. Type sudo apxs -i -a -n php4 libphp4.so

  5. Now type sudo open -a TextEdit /etc/httpd/httpd.conf. TextEdit will open with the web server configuration file. Locate these two lines towards the end of the file: (Use the Find command)
    #AddType application/x-httpd-php .php 
    #AddType application/x-httpd-php-source .phps
    Remove the two hash marks (#), then save the file and quit TextEdit.

  6. Finally, type sudo apachectl graceful to restart the web server.

PHP should now be up and running. You can test it by dropping a file into your Sites folder which is called test.php. Into that file, write this line: <?php phpinfo() ?>.

Now open up 127.0.0.1/~your_username/test.php in your web browser. You should see a status table with information about the PHP module.



User Contributed Notes
Compiling for MacOS X Client
mw aat lanfear doot com
31-Mar-2005 08:53
I was able to compile PHP 5.0.3 pretty much right out of the box on my OS X 10.3.7 PowerBook last night.  I had downloaded the Xcode developer tools from Apple and the november 2004 GCC update.

After downloading and running the MySQL 4.1.10a installer, I was able to do the following (all within the Termainl Utility Application):

Yukimura:mw# tar xfj php-5.0.3.tar.bz2
Yukimura:mw# cd php-5.0.3
Yukimura:mw# ./configure --prefix=/usr/local/php5 --with-apxs=/usr/sbin/apxs --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap
Yukimura:mw# make
Yukimura:mw# su
Password: *******
Yukimura:root# make install

I then only had to edit /private/etc/httpd/httpd.conf and change the first line of:

<IfModule mod_php4.c>
   # If php is turned on, we repsect .php and .phps files.
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps

   # Since most users will want index.php to work we
   # also automatically enable index.php
   <IfModule mod_dir.c>
       DirectoryIndex index.html index.php
   </IfModule>
</IfModule>

from:

<IfModule mod_php4.c>

to:

<IfModule mod_php5.c>

I just restarted the web server with

Yukimura:mw# sudo /usr/sbin/apachectl restart

And I've got a fully working XAMP platform (except OS X has not shutdown scripts -- only startup ....)
BjarneDM <macintosh at mathiesen dot info>
30-Sep-2004 03:43
I've created my own website < http://webadmin.mathiesen.info/ > from which you can download scripts and get instruction on how to compile PHP4 and PHP5 based upon the PHP4 package from ServerLogistics < http://www.serverlogistics.com/ >. These instructions/scripts will only work if you install the whole set of packages from ServerLogistics : Apache2, PHP4 and MySQL.
Michael Hawkshaw
14-Sep-2004 03:11
Please note that Marc has now compiled a PHP 5.0.1 version of his package. It can be downloaded at:

http://www.entropy.ch/software/macosx/php/

There is also a forum on his site for discussing his package should you have have any queries/issues.
BjarneDM <macintosh at mathiesen dot info>
27-Aug-2004 01:09
This will only install a precompiled PHP4 module for the Apache 1.3.x included by Apple in Mac OS X client. This will not install a cli version of PHP.

If you want to play with Apache2 and PHP the way to go is ServerLogistics < http://www.serverlogistics.com/ >, but this will still be a precompiled version. On the other hand you can both get the Apache2 module and a cli version.

ServerLogistics does include some rudimentary information on how to compile yourself on Mac OS X in the pdf documentation, but it is erroneous in some circumstances, and for newer versions of PHP will neccesiate installation of fink < http://fink.sourceforge.net/ > or darwinports < http://darwinports.opendarwin.org/ > in order to get newer libraries.

<Compiling for OS X ServerInstallation on Windows systems>
 Last updated: Thu, 19 May 2005
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: The Server Pages
Last updated: Thu May 19 17:35:34 2005 CDT