<HTML ><HEAD ><TITLE >Servers-Apache 2.0</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="Servers-Apache" HREF="install.apache.html"><LINK REL="NEXT" TITLE="Servers-Caudium" HREF="install.caudium.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.apache.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.caudium.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="install.apache2" ></A >Servers-Apache 2.0</H1 ><P > This section contains notes and hints specific to Apache 2.0 installs of <TT CLASS="literal" >PHP</TT >, both for <A HREF="install.apache2.html#install.apache2.unix" >Unix</A > and <A HREF="install.apache2.html#install.apache2.windows" >Windows</A > versions. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Do not use Apache 2.0 and <TT CLASS="literal" >PHP</TT > in a production environment neither on Unix nor on Windows. </P ></TD ></TR ></TABLE ></DIV ><P > You are highly encouraged to take a look at the <A HREF="http://httpd.apache.org/docs-2.0/" TARGET="_top" >Apache Documentation</A > to get a basic understanding of the Apache 2.0 Server. </P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="compat.apache2" ></A >PHP and Apache 2.0 compatibility notes</H2 ><P > The following versions of PHP are known to work with the most recent version of Apache 2.0: <P ></P ><UL COMPACT="COMPACT" ><LI ><SPAN > PHP 4.3.0 or later available at <A HREF="http://www.php.net/downloads.php" TARGET="_top" >http://www.php.net/downloads.php</A >. </SPAN ></LI ><LI ><SPAN > the latest stable development version. Get the source code <A HREF="http://snaps.php.net/php4-latest.tar.gz" TARGET="_top" > http://snaps.php.net/php4-latest.tar.gz</A > or download binaries for windows <A HREF="http://snaps.php.net/win32/php4-win32-latest.zip" TARGET="_top" > http://snaps.php.net/win32/php4-win32-latest.zip</A >. </SPAN ></LI ><LI ><SPAN > a prerelease version downloadable from <A HREF="http://qa.php.net/" TARGET="_top" >http://qa.php.net/</A >. </SPAN ></LI ><LI ><SPAN > you have always the option to obtain <TT CLASS="literal" >PHP</TT > through <A HREF="http://www.php.net/anoncvs.php" TARGET="_top" >anonymous CVS</A >. </SPAN ></LI ></UL > These versions of <TT CLASS="literal" >PHP</TT > are compatible to Apache 2.0.40 and later. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > Apache 2.0 <TT CLASS="literal" >SAPI</TT >-support started with PHP 4.2.0. PHP 4.2.3 its known to work in conjunction with Apache 2.0.39. Don't try to use this version of <TT CLASS="literal" >PHP</TT > with any other version of Apache. We do not recommend to use PHP 4.2.3 along with Apache 2.0.39. </P ><P > All mentioned versions of <TT CLASS="literal" >PHP</TT > will work still with Apache 1.3.x. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.apache2.unix" ></A >PHP and Apache 2 on Linux</H2 ><P > Download the most recent version of <A HREF="http://www.apache.org/" TARGET="_top" > Apache 2.0</A > and a fitting PHP version from the above mentioned places. This quick guide covers only the basics to get started with Apache 2.0 and <TT CLASS="literal" >PHP</TT >. For more information read the <A HREF="http://httpd.apache.org/docs-2.0/" TARGET="_top" >Apache Documentation</A >. The version numbers have been omitted here, to ensure the instructions are not incorrect. You will need to replace the 'NN' here with the correct values from your files. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN1246" ></A ><P ><B >Example 3-6. Installation Instructions (Apache 2 Shared Module Version) </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >1. gzip -d httpd-2_0_NN.tar.gz 2. tar xvf httpd-2_0_NN.tar 3. gunzip php-NN.tar.gz 4. tar -xvf php-NN.tar 5. cd httpd-2_0_NN 6. ./configure --enable-so 7. make 8. make install Now you have Apache 2.0.NN available under /usr/local/apache2, configured with loadable module support and the standard MPM prefork. To test the installation use your normal procedure for starting the Apache server, e.g.: /usr/local/apache2/bin/apachectl start and stop the server to go on with the configuration for PHP: /usr/local/apache2/bin/apachectl stop. 9. cd ../php4-NN 10. ./configure --with-apxs2=/usr/local/apache2/bin/apxs 11. make 12. make install 13. cp php.ini-dist /usr/local/lib/php.ini Edit your php.ini file to set PHP options. If you prefer this file in another location, use --with-config-file-path=/path in step 10. 14. Edit your httpd.conf file and check that these lines are present: LoadModule php4_module modules/libphp4.so AddType application/x-httpd-php .php You can choose any extension you wish here. .php is simply the one we suggest. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The above statement is correct for the steps shown above. 15. Use your normal procedure for starting the Apache server, e.g.: /usr/local/apache2/bin/apachectl start</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > Following the steps above you will have a running Apache 2.0 with support for <TT CLASS="literal" >PHP</TT > as <TT CLASS="literal" >SAPI</TT > module. Of course there are many more configuration options available for both, Apache and <TT CLASS="literal" >PHP</TT >. For more information use <B CLASS="command" >./configure --help</B > in the corresponding source tree. In case you wish to build a multithreaded version of Apache 2.0 you must overwrite the standard MPM-Module <TT CLASS="filename" >prefork</TT > either with <TT CLASS="filename" >worker</TT > or <TT CLASS="filename" >perchild</TT >. To do so append to your configure line in step 6 above either the option <TT CLASS="option" >--with-mpm=worker</TT > or <TT CLASS="option" >--with-mpm=perchild</TT >. Take care about the consequences and understand what you are doing. For more information read the Apache documentation about the <A HREF="http://httpd.apache.org/docs-2.0/mpm.html" TARGET="_top" > MPM-Modules</A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > To build a multithreaded version of Apache your system must support threads. This also implies to build <TT CLASS="literal" >PHP</TT > with experimental Zend Thread Safety (ZTS). Therefore not all extensions might be available. The recommended setup is to build Apache with the standard <TT CLASS="filename" >prefork</TT > MPM-Module. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="install.apache2.windows" ></A >PHP and Apache 2.0 on Windows</H2 ><P > Consider to read the <A HREF="http://httpd.apache.org/docs-2.0/platform/windows.html" TARGET="_top" > Windows specific notes</A > for Apache 2.0. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Apache 2.0 is designed to run on Windows NT 4.0, Windows 2000 or Windows XP. At this time, support for Windows 9x is incomplete. Apache 2.0 is not expected to work on those platforms at this time. </P ></TD ></TR ></TABLE ></DIV ><P > Download the most recent version of <A HREF="http://www.apache.org/" TARGET="_top" > Apache 2.0</A > and a fitting PHP version from the above mentioned places. Follow the <A HREF="install.windows.html#install.windows.manual" >Manual Installation Steps</A > and come back to go on with the integration of <TT CLASS="literal" >PHP</TT > and Apache. </P ><P > There are two ways to set up <TT CLASS="literal" >PHP</TT > to work with Apache 2.0 on Windows. One is to use the CGI binary the other is to use the Apache module DLL. In either case you need to stop the Apache server, and edit your <TT CLASS="filename" >httpd.conf</TT > to configure Apache to work with <TT CLASS="literal" >PHP</TT >. </P ><P > You need to insert these three lines to your Apache <TT CLASS="filename" >httpd.conf </TT > configuration file to set up the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >CGI binary</I ></SPAN >: <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN1281" ></A ><P ><B >Example 3-7. PHP and Apache 2.0 as CGI</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="apache" >ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php.exe"</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > If you would like to use <TT CLASS="literal" >PHP</TT > as a module in Apache 2.0, be sure to move <TT CLASS="filename" >php4ts.dll</TT > to <TT CLASS="filename" >winnt/system32</TT > (for Windows NT/2000) or <TT CLASS="filename" >windows/system32</TT > (for Windows XP), overwriting any older file. You need to insert these two lines to your Apache <TT CLASS="filename" >httpd.conf </TT > configuration file to set up the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >PHP-Module</I ></SPAN > for Apache 2.0: <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN1291" ></A ><P ><B >Example 3-8. PHP and Apache 2.0 as Module</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="apache" >LoadModule php4_module c:/php/sapi/php4apache2.dll AddType application/x-httpd-php .php</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > Remember to substitute the <TT CLASS="filename" >c:/php/</TT > for your actual path to <TT CLASS="literal" >PHP</TT > in the above examples. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Don't mix up your installation with dll files from <SPAN CLASS="emphasis" ><I CLASS="emphasis" >different PHP versions </I ></SPAN >. You have the only choice to use the dll's and extensions that ship with your downloaded PHP version. </P ></TD ></TR ></TABLE ></DIV ></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.apache.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.caudium.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Servers-Apache</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="installation.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Servers-Caudium</TD ></TR ></TABLE ></DIV ></BODY ></HTML >