PHP Development Resources

How do I download and install a pre-compiled ODBC-enabled PHP module for Mac OS X?

This article explains how to install PHP with ODBC support, offering a GUI-based
installer as well as the ability to download and install a pre-compiled PHP
module for Mac OS X with ODBC support. Note: This module will only work
with the original Apache web server, as pre-installed in Mac OS X by Apple.


Downloadable GUI-based installation
of PHP bundle
(DMG format): http://www.serverlogistics.com/php4.php#download>

Applies to Apache 2 installations only


Terminal-based installation of PHP module
for Apache

Applies to Apache 1 installations only



Mac OS X 10.2 and later
:


1. To update a previously installed version of the module to the most recent
version, execute the following Terminal commands:



<!--curl -O http://oplussol4.openlinksw.com:9998/DAV/SUPPORT/PHP/Mac/OSX_10.2/libphp4.so.gz-->curl -O http://www2.entropy.ch/download/libphp4.so.gz>

Note: the command above belongs on a single line, with no spaces in the
URL. You will need to wait for a bit for the download to complete.


gunzip libphp4.so.gz

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

sudo apachectl graceful



2. To install the ODBC-compliant module, execute the following Terminal commands:




<!--curl -O http://oplussol4.openlinksw.com:9998/DAV/SUPPORT/PHP/Mac/OSX_10.2/libphp4.so.gz-->
curl -O http://www2.entropy.ch/download/libphp4.so.gz>

Note: the command above belongs on a single line, with no spaces in the
URL. You will need to wait for a bit for the download to complete.


gunzip libphp4.so.gz

sudo mv libphp4.so /usr/libexec/httpd/



3 . To activate the new PHP module, execute the following Terminal commands:



cd /etc/httpd

sudo apxs -e -a -n php4 libexec/httpd/libphp4.so

echo 'echo "AddType? application/x-httpd-php .php" >> /etc/httpd/httpd.conf'
| sudo sh –s

Note: the command above belongs on a single line. For best results,
copy and paste from your browser to a text editor, and strip out any line-feeds.



sudo apachectl graceful



4. Proceed to Post installation steps below.




Mac OS X 10.1.5 and earlier:


1. To install the ODBC-compliant module, execute the following Terminal commands:



curl –O
http://www2.entropy.ch/download/libphp4.so.gz-10.1> Note: the command above belongs on a single line, with no spaces in the URL. You will need to wait for the above download to complete. gunzip libphp4.so.gz sudo mv libphp4.so /usr/libexec/httpd/



2. To activate the new PHP module, execute the following Terminal commands:



cd /etc/httpd

sudo apxs -e -a -n php4 libexec/httpd/libphp4.so

sudo perl -p -i.bak -e 's%#(AddType? S+-php[ -])%$1%i' httpd.conf

Note: the command above belongs on a single line. For best results,
copy and paste from your browser to a text
editor, and strip out
any line-feeds.



sudo apachectl graceful



4. Proceed to Post installation steps below.


Post installation (all platforms):


1. Next, you need to disable two modules in the /etc/httpd/httpd.conf
file, if they are enabled. Comment them out like this:



# AddModule? Mod_Auth_Apple.c


# LoadModule? Apple_auth_module



2. Restart Apache. PHP should now be up and running.


3. You can test it by creating a file named test.php in your "Sites"
folder. In that file, place a single line reading as follows:



<?php phpinfo() ?>



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



For more information on PHP module update and installation problems, visit http://www.entropy.ch/software/macosx/php/#intro>.