<HTML ><HEAD ><TITLE >Unix/Mac OS X installs</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Installation" HREF="installation.html"><LINK REL="PREVIOUS" TITLE="Unix/Linux installs" HREF="install.linux.html"><LINK REL="NEXT" TITLE="Unix/OpenBSD installs" HREF="install.openbsd.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="install.linux.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 3. Installation</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="install.openbsd.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.macosx" ></A >Unix/Mac OS X installs</H1 ><P > This section contains notes and hints specific to installing PHP on Mac OS X Server. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.packages" ></A >Using Packages</H2 ><P > There are a few pre-packaged and pre-compiled versions of PHP for Mac OS X. This can help in 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 may need to build PHP and/or your web server yourself. If you are unfamiliar with building and compiling your own software, it's worth checking whether somebody has already built a packaged version of PHP with the features you need. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.compile" ></A >Compiling for OS X server</H2 ><P > There are two slightly different versions of Mac OS X, client and server. The following is for OS X Server. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="install.macosx.compile.example" ></A ><P ><B >Example 3-2. Mac OS X server install</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >1. Get the latest distributions of Apache and PHP 2. Untar them, and run the configure program on 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. You may also want to add this line: setenv OPTIM=-O2 If you want the compiler to do some optimization. 5. Next, go to the PHP 4 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 have any other additions (MySQL, GD, etc.), be sure to add them here. For the --with-apache string, put in the path to your apache source directory, for example "/src/apache_1.3.12". 6. make 7. make install This will add a directory to your Apache source directory under src/modules/php4. 8. Now, reconfigure Apache to build in PHP 4. ./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 may get a message telling you that libmodphp4.a is out of date. If so, go to the 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 10. make install 11. copy and rename the php.ini-dist file to your "bin" directory from your PHP 4 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</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.macosx.client" ></A >Compiling for MacOS X client</H2 ><P > Those tips are graciously provided by <A HREF="http://www.entropy.ch/software/macosx/" TARGET="_top" >Marc Liyanage</A >. </P ><P > The PHP module for the Apache web server included in Mac OS X. This version includes support for the MySQL and PostgreSQL databases. </P ><P > NOTE: Be careful when you do this, you could screw up your Apache web server! </P ><P > Do this to install: <P ></P ><UL ><LI ><P > 1. Open a terminal window </P ></LI ><LI ><P > 2. Type "wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz", wait for download to finish </P ></LI ><LI ><P > 3. Type "gunzip libphp4.so.gz" </P ></LI ><LI ><P > 4. Type "sudo apxs -i -a -n php4 libphp4.so" </P ></LI ></UL > Now type "<TT CLASS="literal" >sudo open -a TextEdit /etc/httpd/httpd.conf</TT >" TextEdit will open with the web server configuration file. Locate these two lines towards the end of the file: (Use the Find command) <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="apache" >#AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps</PRE ></TD ></TR ></TABLE > Remove the two hash marks (<TT CLASS="literal" >#</TT >), then save the file and quit TextEdit. </P ><P > Finally, type "<TT CLASS="literal" >sudo apachectl graceful</TT >" to restart the web server. </P ><P > 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: "<TT CLASS="literal" ><?php phpinfo() ?></TT >". </P ><P > Now open up <TT CLASS="literal" >127.0.0.1/~your_username/test.php</TT > in your web browser. You should see a status table with information about the PHP module. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="install.linux.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="install.openbsd.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Unix/Linux installs</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="installation.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Unix/OpenBSD installs</TD ></TR ></TABLE ></DIV ></BODY ></HTML >