apache setup on windows<

liunx

Guest
In the past many months I have noticed the need for such a tutorial.
I have seen many people ask how they setup a windows environment so it can run php.
So I have created this short tutorial. it by all means doesn't end all possiblities but
just shows one way to do it. I will take it for granted that you have Download ed and installed Apache (<!-- m --><a class="postlink" href="http://apache.gnusoft.net/httpd/binaries/win32/">http://apache.gnusoft.net/httpd/binaries/win32/</a><!-- m -->) and php (<!-- m --><a class="postlink" href="http://www.php.net/Download">http://www.php.net/Download</a><!-- m --> s.php).

for Apache you can take any version you want. generally the ones that end in .exe. if you install apache 1.3.xx and then install php 4.3.x (or latest version), php should configure apache for you if you Download the installer, but just in case it doesn't you can read below.

-------------------------------------------------
to get apache 1.3.xx to run php as a module.

open up the httpd.conf file and edit it as shown.

~ = Approximately
All lines to be added are in blue

on line ~194 add this at the end of all LoadModules

LoadModule php4_module C:\php\php4apache.dll

change the path (C:\) to the path you installed php at.
the php4apache.dll should be in the same spot as the php.exe.
just copy the file to the php folder.
you can usually find this file in php/sapi/php4apache.dll.

then on line ~242 add this line

AddModule mod_php4.c

at the end of all the AddModules.

on line ~727 add these lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

on line ~867
Action application/x-httpd-php4 "/php/php.exe"
if you have that line already make sure you have a "4" after 'x-httpd-php', if not add that whole line

******
on line ~428
in your php.ini
edit the extension directory:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\php\extensions\"
make sure you change the path (C:\) to where you installed php.
******
start apache and it should work.

---------------------------------------------------

to get apache 2.x.xx to run php as a module.

this is more difficult as php is still experimental with apache 2.x

I will show you how to do it so it runs as cgi mode instead.

on line ~428
edit the extension directory:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\php\extensions\"
make sure you change the path (C:\) to where you installed php.

on line ~722 add the following lines

AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .phtml

the fisrt line should already be there.

on line ~474 add the following line:
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
ScriptAlias /php/ "C:/php/"
change the path to where you installed php.

on line ~771 add the following line

Action application/x-httpd-php "/php/php.exe"

that should be all. now save it and then restart apache.I found it pretty difficult to get apache and php to run on a win9x machine. not sure if it is the newer versions of php or apache. I did get it to run apache 1.3.x and php versions less than 4.3. a while ago so take it how you want.
 
Back
Top