Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2945

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>Servers-Apache</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-CGI/Commandline"
HREF="install.commandline.html"><LINK
REL="NEXT"
TITLE="Servers-Apache 2.0"
HREF="install.apache2.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.commandline.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.apache2.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="install.apache"
></A
>Servers-Apache</H1
><P
>&#13;    This section contains notes and hints specific to Apache installs
    of PHP, both for <A
HREF="install.apache.html#install.apache.unix"
>Unix</A
> and
    <A
HREF="install.apache.html#install.apache.windows"
>Windows</A
> versions. We also
    have <A
HREF="install.apache2.html"
>instructions and notes for Apache 2
    on a separate page</A
>.
   </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.apache.unix"
></A
>Details of installing PHP with Apache on Unix</H2
><P
>&#13;     You can select arguments to add to the
     <B
CLASS="command"
>configure</B
> on line 10 below from the <A
HREF="install.configure.html"
>Complete list of configure
     options</A
>. The version numbers have been omitted here, to
     ensure the instructions are not incorrect. You will need to replace
     the 'xxx' 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="install.apache.unix.longer"
></A
><P
><B
>Example 3-5. 
      Installation Instructions (Apache Shared Module Version) for PHP 4
     </B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>1.  gunzip apache_xxx.tar.gz
2.  tar -xvf apache_xxx.tar
3.  gunzip php-xxx.tar.gz
4.  tar -xvf php-xxx.tar
5.  cd apache_xxx
6.  ./configure --prefix=/www --enable-module=so
7.  make
8.  make install
9.  cd ../php-xxx
10. ./configure --with-mysql --with-apxs=/www/bin/apxs
11. make
12. make install

  If you decide to change your configure options after installation
  you only need to repeat the last three steps. You only need to 
  restart apache for the new module to take effect. A recompile of
  Apache is not needed.

13. cp php.ini-dist /usr/local/lib/php.ini

  You can edit your .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 or srm.conf file and check that these lines are
    present and not commented out:
  
   AddType application/x-httpd-php .php

   LoadModule php4_module        libexec/libphp4.so
 
  You can choose any extension you wish here.  .php is simply the one
  we suggest. You can even include .html, and .php3 can be added for 
  backwards compatibility.
 
  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. (You must
    stop and restart the server, not just cause the server to reload by
    use a HUP or USR1 signal.)</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;      Depending on your Apache install and Unix variant, there are many
      possible ways to stop and restart the server. Below are some typical
      lines used in restarting the server, for different apache/unix
      installations. You should replace <TT
CLASS="literal"
>/path/to/</TT
> with
      the path to these applications on your systems.
      <DIV
CLASS="informalexample"
><A
NAME="AEN1104"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>1. Several Linux and SysV variants:
/etc/rc.d/init.d/httpd restart

2. Using apachectl scripts:
/path/to/apachectl stop
/path/to/apachectl start

3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:
/path/to/httpsdctl stop
/path/to/httpsdctl start

4. Using mod_ssl, or another SSL server, you may want to manually
stop and start:
/path/to/apachectl stop
/path/to/apachectl startssl</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
      The locations of the apachectl and http(s)dctl binaries often
      vary. If your system has <TT
CLASS="literal"
>locate</TT
> or
      <TT
CLASS="literal"
>whereis</TT
> or <TT
CLASS="literal"
>which</TT
> commands,
      these can assist you in finding your server control programs.
     </P
><P
>&#13;      Different examples of compiling PHP for apache are as follows:
      <DIV
CLASS="informalexample"
><A
NAME="AEN1110"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="shell"
>./configure --with-apxs --with-pgsql</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will create a <TT
CLASS="filename"
>libphp4.so</TT
> shared
      library that is loaded into Apache using a LoadModule line in
      Apache's <TT
CLASS="filename"
>httpd.conf</TT
> file. The PostgreSQL
      support is embedded into this <TT
CLASS="filename"
>libphp4.so</TT
>
      library.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN1117"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>./configure --with-apxs --with-pgsql=shared</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will create a <TT
CLASS="filename"
>libphp4.so</TT
> shared
      library for Apache, but it will also create a
      <TT
CLASS="filename"
>pgsql.so</TT
> shared library that is loaded into
      PHP either by using the extension directive in
      <TT
CLASS="filename"
>php.ini</TT
> file or by loading it explicitly in
      a script using the <A
HREF="function.dl.html"
><B
CLASS="function"
>dl()</B
></A
> function.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN1125"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>./configure --with-apache=/path/to/apache_source --with-pgsql</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will create a <TT
CLASS="filename"
>libmodphp4.a</TT
> library, a
      <TT
CLASS="filename"
>mod_php4.c</TT
> and some accompanying files and
      copy this into the <TT
CLASS="literal"
>src/modules/php4</TT
> directory
      in the Apache source tree. Then you compile Apache using
      <TT
CLASS="literal"
>--activate-module=src/modules/php4/libphp4.a</TT
>
      and the Apache build system will create
      <TT
CLASS="filename"
>libphp4.a</TT
> and link it statically into the
      <TT
CLASS="filename"
>httpd</TT
> binary. The PostgreSQL support is
      included directly into this <TT
CLASS="filename"
>httpd</TT
> binary,
      so the final result here is a single <TT
CLASS="filename"
>httpd</TT
>
      binary that includes all of Apache and all of PHP.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN1137"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>./configure --with-apache=/path/to/apache_source --with-pgsql=shared</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      Same as before, except instead of including PostgreSQL support
      directly into the final <TT
CLASS="filename"
>httpd</TT
> you will get
      a <TT
CLASS="filename"
>pgsql.so</TT
> shared library that you can load
      into PHP from either the <TT
CLASS="filename"
>php.ini</TT
> file or
      directly using <A
HREF="function.dl.html"
><B
CLASS="function"
>dl()</B
></A
>.
     </P
><P
>&#13;      When choosing to build PHP in different ways, you should consider
      the advantages and drawbacks of each method. Building as a shared
      object will mean that you can compile apache separately, and don't
      have to recompile everything as you add to, or change, PHP.
      Building PHP into apache (static method) means that PHP will
      load and run faster. For more information, see the Apache
      <A
HREF="http://httpd.apache.org/docs/dso.html"
TARGET="_top"
>webpage on DSO support</A
>.
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      Apache's default http.conf currently ships with a section that looks
      like this:
      <DIV
CLASS="informalexample"
><A
NAME="AEN1148"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>User nobody
Group "#-1"</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
      Unless you change that to "Group nogroup" or something like that ("Group daemon" is
      also very common) PHP will not be able to open files.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
     Make sure you specify the installed version of apxs when using --with-apxs=/path/to/apxs.
     You must NOT use the apxs version that is in the apache sources but the one that is actually
     installed on your system.
     </P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.apache.windows"
></A
>Installing PHP on Windows with Apache 1.3.x</H2
><P
>&#13;     There are two ways to set up PHP to work with Apache 1.3.x
     on Windows. One is to use the CGI binary (php.exe),
     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"
>srm.conf</TT
> or <TT
CLASS="filename"
>httpd.conf</TT
>
     to configure Apache to work with PHP.
    </P
><P
>&#13;     It is worth noting here that now the SAPI module has been 
     made more stable under windows, we recommend it's use above
     the CGI binary, since it is more transparent and secure.
    </P
><P
>&#13;     Although there can be a few variations of configuring PHP
     under Apache, these are simple enough to be used by the
     newcomer. Please consult the Apache Docs for further
     configuration directives.
    </P
><P
>&#13;     If you unziped the PHP package to c:\php\ as described
     in the <A
HREF="install.windows.html#install.windows.manual"
>Manual
     Installation Steps</A
> section, you need to insert
     these lines to your Apache configuration file to set
     up the CGI binary:
     <P
></P
><UL
><LI
><P
>&#13;        <TT
CLASS="literal"
>&#13;         ScriptAlias /php/ "c:/php/"
        </TT
>
       </P
></LI
><LI
><P
>&#13;        <TT
CLASS="literal"
>&#13;         AddType application/x-httpd-php .php .phtml
        </TT
>
       </P
></LI
><LI
><P
>&#13;        <TT
CLASS="literal"
>&#13;         Action application/x-httpd-php "/php/php.exe"
        </TT
>
       </P
></LI
></UL
>
     Note that the second line in the list above can be found
     in the actual versions of <TT
CLASS="filename"
>httpd.conf</TT
>,
     but it is commented out. Remember also to substitute the 
     <TT
CLASS="filename"
>c:/php/</TT
> for your actual path to PHP.
     </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
>&#13;      By using the CGI setup, your server is open
      to several possible attacks. Please read
      our <A
HREF="security.cgi-bin.html"
>CGI security 
      section</A
> to learn how to defend yourself from attacks.
     </P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     If you would like to use PHP as a module in Apache,
     be sure to move <TT
CLASS="filename"
>php4ts.dll</TT
> to
     the windows/system (for Windows 9x/Me) or winnt/system32
     (for Windows NT/2000/XP) directory, overwriting any older file.
     Then you should add the following two lines to you Apache
     conf file:
     <P
></P
><UL
><LI
><P
>&#13;        <TT
CLASS="literal"
>&#13;         LoadModule php4_module c:/php/sapi/php4apache.dll
        </TT
>
       </P
></LI
><LI
><P
>&#13;        <TT
CLASS="literal"
>&#13;          AddType application/x-httpd-php .php .phtml
        </TT
>
       </P
></LI
></UL
>
    </P
><P
>&#13;     After changing the configuration
     file, remember to restart the server, for example,
     <TT
CLASS="literal"
>NET STOP APACHE</TT
> followed by
     <TT
CLASS="literal"
>NET START APACHE</TT
>, if you run Apache
     as a Windows Service, or use your regular shortcuts.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      You may find after using the windows installer for Apache
      that you need to define the <TT
CLASS="literal"
>AddModule</TT
>
      directive for <TT
CLASS="filename"
>mod_php4.c</TT
> in the 
      configuration file (<TT
CLASS="filename"
>httpd.conf</TT
>).
      This is done by adding <TT
CLASS="literal"
>AddModule mod_php4.c</TT
>
      to the <TT
CLASS="literal"
>AddModule</TT
> list, near the beginning
      of the configuration file. This is especially important if
      the <TT
CLASS="literal"
>ClearModuleList</TT
> directive is defined.
      Failure to do this may mean PHP will not be registered as an 
      Apache module.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     There are 2 ways you can use the source code highlighting feature,
     however their ability to work depends on your installation.
     If you have configured Apache to use PHP as an ISAPI module, then by 
     adding the following line to your configuration file you can use
     this feature: <TT
CLASS="literal"
>AddType application/x-httpd-php-source .phps
     </TT
>
    </P
><P
>&#13;     If you chose to configure Apache to use PHP as a CGI binary, you
     will need to use the <A
HREF="function.show-source.html"
><B
CLASS="function"
>show_source()</B
></A
> function. To
     do this simply create a PHP script file and add this code: 
     <TT
CLASS="literal"
>&#60;?php show_source ("original_php_script.php"); ?&#62;</TT
>. 
     Substitute <TT
CLASS="literal"
>original_php_script.php</TT
> with 
     the name of the file you wish to show the source of. 
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      On Win-Apache all backslashes in a path statement such
      as "c:\directory\file.ext", must be converted to
      forward slashes, as "c:/directory/file.ext".
     </P
></BLOCKQUOTE
></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.commandline.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.apache2.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Servers-CGI/Commandline</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-Apache 2.0</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>