downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/install.windows.apache1.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/install.windows.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'install.windows.apache1.php',
   
1 => 'Apache 1.3.x on Microsoft Windows',
  ),
 
'up' =>
  array (
   
0 => 'install.windows.php',
   
1 => 'Installation on Windows systems',
  ),
 
'prev' =>
  array (
   
0 => 'install.windows.iis7.php',
   
1 => 'Microsoft IIS 7.0 and later',
  ),
 
'next' =>
  array (
   
0 => 'install.windows.apache2.php',
   
1 => 'Apache 2.0.x on Microsoft Windows',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="install.windows.apache1" class="sect1">
    <h2 class="title">Apache 1.3.x on Microsoft Windows</h2>
    <p class="para">
     This section contains notes and hints specific to Apache 1.3.x installs
     of PHP on Microsoft Windows systems. There are also
     <a href="install.windows.apache2.php" class="link">instructions and notes
     for Apache 2</a> on a separate page.
    </p>
    <blockquote><p><b class="note">Note</b>:
    
      Please read the <a href="install.windows.manual.php" class="link">manual
      installation steps</a> first!
     <br />
    </p></blockquote>
   
    <p class="simpara">
     There are two ways to set up PHP to work with Apache 1.3.x
     on Windows. One is to use the CGI binary (<var class="filename">php.exe</var>
     for PHP 4 and <var class="filename">php-cgi.exe</var> for PHP 5),
     the other is to use the Apache Module DLL. In either case
     you need to edit your <var class="filename">httpd.conf</var> to configure Apache to
     work with PHP, and then restart the server.
    </p>
   
    <p class="simpara">
     It is worth noting here that now the SAPI module has been
     made more stable under Windows, we recommend it&#039;s use above
     the CGI binary, since it is more transparent and secure.
    </p>
   
    <p class="simpara">
     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 Documentation for further
     configuration directives.
    </p>
 
    <p class="simpara">
     After changing the configuration file, remember to restart the server, for
     example, <strong class="command">NET STOP APACHE</strong> followed by
     <strong class="command">NET START APACHE</strong>, if you run Apache as a Windows
     Service, or use your regular shortcuts.
    </p>
   
    <blockquote><p><b class="note">Note</b>: <span class="simpara">Remember that when adding
path values in the Apache configuration files on Windows, all backslashes
such as <var class="filename">c:\directory\file.ext</var> must be converted to
forward slashes: <var class="filename">c:/directory/file.ext</var>. A trailing
slash may also be necessary for directories.</span></p></blockquote>

    <div id="install.windows.apache1.module" class="sect2">
     <h3 class="title">Installing as an Apache module</h3>
     <p class="para">
      You should add the following lines to your Apache <var class="filename">httpd.conf</var> file:
     </p>
     <p class="para">
      </p><div class="example">
       <p><b>Example #1 PHP as an Apache 1.3.x module</b></p>
        <div class="example-contents para"><p>
         This assumes PHP is installed to <var class="filename">c:\php</var>. Adjust the
         path if this is not the case.
        </p></div>
        <div class="example-contents para"><p>
         For PHP 4:
        </p></div>
        <div class="example-contents programlisting">
<div class="apache-confcode"><pre class="apache-confcode"># Add to the end of the LoadModule section
# Don&#039;t forget to copy this file from the sapi directory!
LoadModule php4_module &quot;C:/php/php4apache.dll&quot;

# Add to the end of the AddModule section
AddModule mod_php4.c</pre>
</div>
       </div>

       <div class="example-contents para"><p>
        For PHP 5:
       </p></div>
       <div class="example-contents programlisting">
<div class="apache-confcode"><pre class="apache-confcode"># Add to the end of the LoadModule section
LoadModule php5_module &quot;C:/php/php5apache.dll&quot;

# Add to the end of the AddModule section
AddModule mod_php5.c</pre>
</div>
       </div>

       <div class="example-contents para"><p>
        For both:
       </p></div>
       <div class="example-contents programlisting">
<div class="apache-confcode"><pre class="apache-confcode"># Add this line inside the &lt;IfModule mod_mime.c&gt; conditional brace
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps</pre>
</div>
       </div>

      </div><p>
     </p>
    </div>

    <div id="install.windows.apache1.cgi" class="sect2">
     <h3 class="title">Installing as a CGI binary</h3>
   
     <p class="para">
      If you unzipped the PHP package to <var class="filename">C:\php\</var> as described
      in the <a href="install.windows.manual.php" class="link">Manual
      Installation Steps</a> section, you need to insert
      these lines to your Apache configuration file to set
      up the CGI binary:
      </p><div class="example">
       <p><b>Example #2 PHP and Apache 1.3.x as CGI</b></p>
        <div class="example-contents programlisting">
<div class="apache-confcode"><pre class="apache-confcode">ScriptAlias /php/ &quot;c:/php/&quot;
AddType application/x-httpd-php .php

# For PHP 4
Action application/x-httpd-php &quot;/php/php.exe&quot;

# For PHP 5
Action application/x-httpd-php &quot;/php/php-cgi.exe&quot;

# specify the directory where php.ini is
SetEnv PHPRC C:/php</pre>
</div>
       </div>

      </div><p>
      Note that the second line in the list above can be found
      in the actual versions of <var class="filename">httpd.conf</var>, but it is commented out. Remember
      also to substitute the <var class="filename">c:/php/</var> for your actual path to
      PHP.
     </p>
     <div class="warning"><b class="warning">Warning</b><p class="para">A server deployed in CGI mode is open
to several possible vulnerabilities. Please read our
<a href="security.cgi-bin.php" class="link">CGI security section</a> to learn how to
defend yourself from such attacks.</p></div>
     <p class="simpara">
      If you would like to present PHP source files syntax highlighted, there
      is no such convenient option as with the module version of PHP.
      If you chose to configure Apache to use PHP as a CGI binary, you
      will need to use the <a href="function.highlight-file.php" class="function">highlight_file()</a> function. To
      do this simply create a PHP script file and add this code:
      <i>&lt;?php highlight_file(&#039;some_php_script.php&#039;); ?&gt;</i>.
     </p>
    </div>

   </div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites