
|
Introduction:
While MacOS X ships with mod_php installed, it does not include PHP-CGI capability, or many options commonly needed for WebMail services. This HOW-TO will provide step-by-step information and packages needed to compile and install PHP 4.3.0 on MacOS 10.2.4. A basic understanding of shell commands and compiling and installing open source packages is required, as is an install of the Apple Developer Tools CD, of course. I used the following compiletime options for use with SqurrelMail 1.2.11 (This should work with Horde Imp 1.3 as well):
./configure --with-imap --with-gettext --with-apxs --with-xml --with-mcrypt --with-imap-ssl=/usr/lib
|

|
Libraries Needed:
For the above options, the following libraries are needed. These packages should compile fine on your system. Special instructions are included below. Some are patched, others are versions known to work with MacOS X. openssl, uw-imap, libmcrypt, gettext.
Library Installation Instructions:
openssl: ./configure ; make ; sudo make install
libmcrypt: ./configure ; make ; sudo make install
gettext: ./configure ; make ; sudo make install
uw-imap: make osx ; sudo cp c-client/*.h /usr/include ; sudo cp c-client/c-client.a /usr/lib/libc-client.a
Notes on uw-imap: There is no 'make install' for UW's IMAP. You need to install the c-client library and the imap headers manually with the commands listed above. Additionally, you will need to install and configure the pop3 or imap daemons if you intend to run a WebMail interface. This is described in imap-2002b/docs/BUILD (see STEP 1: inetd setup) NOTE: The imap headers conflict with the standard 'unix.h'. You must rename /usr/include/unix.h to /usr/include/unix-imap.h after php is installed!

|

|
PHP install and configuration with Apache:
Configure php with the above options, make and make install. This should go smoothly if you have successfully installed the four libraries above. Your next step is to configure apache to use the php module. The simplest way to do this is to uncomment the following lines in the file /etc/httpd/httpd.conf:
Line #239: LoadModule php4_module libexec/httpd/libphp4.so
Line #281: AddModule mod_php4.c
and add the following lines near the other AddType statements:
Line #851: AddType application/x-httpd-php .php
Line #852: AddType application/x-httpd-php-source .phps
Now, restart apache with 'sudo /usr/sbin/apachectl restart'. You can test mod_php4's functionality with the following file, 'test.php':
<html><body>
<H1>Gleefully Served By MacOS X</H1>
<? phpinfo()?>
</body></html>

|

|
Conclusion:
You should be up and running if you get the nicely formatted phpinfo page from the above code. If not, double check all of your libraries for proper installation. If you're having any troubles, don't hesitate to email me personally. This is an early draft of this document, so there may be errors. Feel free to point them out. Don't forget to move /usr/include/unix.h to /usr/include/unix-imap.h to prevent later compilation problems of other packages.
If you're intending to run WebMail, you may want to check out my MacOS X Apache-SSL HOW-TO as well. (COMING SOON)

|