Mac OS X Installs
This section contains notes and hints specific to installing PHP on MAC OS x.
Using Packages
There are a few pre-packaged and pre-compiled versions of PHP for Mac OS X. This can greatly assist into setting up a standard configuration, but if you need to have a different set of features (such As a secure server, or a different database driver, you'll need to build PHP and/or your Web server yourself. If you are are unfamiliar with building and compiling your own, it ' s software worth investigating or not whether somebody Already built a packaged version of PHP with the features your need. Lightyear Design offers a pre-built version of PHP for OS X, as does Tenon InterSystems.
Compiling for OS X server
There are two slightly different of Mac OS X, client and server. The following is for OS X Server.
Example 2-3. MAC OS X Server Install
1. Get the latest distributions of Apache and PHP
2. Untar them, and run the Configure program in Apache like so.
./configure--EXEC-PREFIX=/USR
--localstatedir=/var
--mandir=/usr/share/man
--libexecdir=/system/library/apache/modules
--iconsdir=/system/library/apache/icons
--includedir=/system/library/frameworks/apache.framework/versions/1.3/headers
--enable-shared=max
--enable-module=most
--target=apache
4. May also want to add this line:
Setenv Optim=-o2
If you are want the compiler to do some optimization.
5. Next, go to the PHP4 source directory and configure it.
./configure--PREFIX=/USR
--sysconfdir=/etc
--localstatedir=/var
--mandir=/usr/share/man
--with-xml
--with-apache=/src/apache_1.3.12
If you are have any other addiitons (MySQL, GD, etc.), be sure to add
them here. For the--with-apache string, put on the path to your
Apache source directory, for example "/src/apache_1.3.12".
6. Make
7. Make Install
This is add a directory to your Apache source directory under
Src/modules/php4.
8. Now, reconfigure Apache to builds in PHP4.
./configure--EXEC-PREFIX=/USR
--localstatedir=/var
--mandir=/usr/share/man
--libexecdir=/system/library/apache/modules
--iconsdir=/system/library/apache/icons
--includedir=/system/library/frameworks/apache.framework/versions/1.3/headers
--enable-shared=max
--enable-module=most
--target=apache
--activate-module=src/modules/php4/libphp4.a
You could get a message telling this libmodphp4.a is out of date.
If So, SRC/MODULES/PHP4 directory inside your Apache
Source directory and run this command:
Ranlib libmodphp4.a
Then go back to the root of the Apache source directory and run the
Above configure command again. That ' ll bring the link table up to
Date.
9. Make
Make install
Copy and rename the Php.ini-dist file to your ' bin ' directory from your
PHP4 Source directory:
CP Php.ini-dist/usr/local/bin/php.ini
or (if your don ' t have a local directory)
CP Php.ini-dist/usr/bin/php.ini