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.

Внимание

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.



Compiling for MacOS X Client
Michael Hawkshaw
14-Sep-2004 01: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 11: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: Mon, 14 Nov 2005