PHP: Compiling for MacOS X Client - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Installation on Windows systems Compiling for OS X Server

Last updated: Fri, 26 Jan 2007

view this page in

# 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.

add a note User Contributed Notes
Compiling for MacOS X Client
php dot developement at ipscripted dot com
24-Aug-2006 09:08
`You can aslo compile php 5 from source for use with the Apache 2 and MySQL packge from server logistics:
Download the latest source (at time of writing, 5.1.5) from php.net, unpack it to any directory you have write access to (your home directory, for example). Make sure that Apache 2 is stopped. Then open a terminal.
1)If you are running as a limited user (which you should generally do), you need to log in as a administrator by typing
login admin
and then entering your password
if you are running as an administrator, skip step 1
2)change to the directory in which you have php unpacked to:
cd /directory/in/which/is/php-1.5.1
3) configure:
./configure --prefix=/Library/PHP5 --with-mysql=/Library/MySQL --with-apxs2=/Library/Apache2/bin/apxs
you can also append any other configuration options you want
4) type:
make
this will compile php. You need to have GCC installed, you can get it for free with Apple's xcode Developement environment.
5) when make finnished, type:
make install
if you are running as a administrator (but not root), type
sudo make install
it will ask you for your password and then install php into the specified directory
You might have to add the following lines to your httpd.conf, if you hadn't had Server Logistics php 4 installed.
6) Start Apache and test php by creating a new file test.php and saving the following line to it:
<?php phpinfo(); ?>
when you browse to that file, you should see the php info page`
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.`
add a note
Installation on Windows systems Compiling for OS X Server

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST