Your Own PHP Server w/ Apache
       rewritten by dudeman, initial instructions by S/Sgt-Reptile | 19 August 2004

You are on page 3 of this tutorial. If you stumbled upon this page somehow, navigate to the page which you wish.

Page 1 - Setting up | Page 2 - Installing Apache | Page 3 - Installing PHP

We're on home stretch... and this one's no doozie

Step 3 - Installing PHP
You downloaded the zip, did you not? If you didn't, hop back to Page 1.

Alright. To speed us ahead a few minutes, I uploaded the php.ini file which you are to extract and place in your Windows root. Apache must be able to access it. For Windows 98/ME/XP it is C:\Windows and for Windows NT or 2000 it is C:\WINNT.

If you did not base this tutorial on the C drive, then you must open php.ini and find+replace all matching "C:\" results with whichever drive you used. Don't forget to change the Windows to WINNT if you are using NT or 2000, since that ini was generated on an XP box.

Open up and extract it all to C:\web\php.

Integrating PHP into Apache

  1. Remember our Apache configuration file? Open up C:\web\conf\httpd.conf again and search "LoadModule". You will see a bunch modules commented with the # character. Paste in:
    LoadModule php5_module "c:/web/php/php5apache2.dll"
  2. Continuing on, look for this: "#AddType text/html .shtml". Underneath it, place:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .inc

    We just told Apache to parse .php files and not set them as downloads since it is an unknown extension.
  3. Last but not least, lets set index.php as a valid directory index, like index.html. Search for:
    DirectoryIndex index.html index.html.var
    and replace the line with:
    DirectoryIndex index.php index.html index.html.var
  4. Save and close the httpd.conf file. Restart Apache by clicking the service monitor in your task tray and navigating to the 'Restart ' button.
  5. Inhale, exhale. You have just completed building your own web server at a beginner's stage, with style.

Wanna test it? Okay a little 'Hello World' wouldn't hurt.

PHP Test File
Open notepad or your favorite web editor. For me, I will use Dreamweaver. Remember, PHP is about server side scripting, so 'what-you-see-is-what-you-get' editors will not help you much here.

Place in the notepad, or codebox by pressing F10 if your using Dreamweaver the following:

$time = time();
$thetime = date("l, jS F Y g:ia",$time);
echo "Hello world! The time is currently". $thetime .".";

Save it as "hello.php" and load it in C:\web\apache\htdocts\. Lets load it by typing http://localhost/hello.php.

Note - The equivalent of CHMOD 777
In order for you to allow your scripts access for reading and writing, you will need to "Change Mode" it. You might ask how, since you don't have an FTP server running that you can just CHMOD 777 (full access) with. Really, all you have to do is just right click the directory where the php scripts and files being modified are in (just do the whole htdocs) and go to properties -> security -> and give all users permission by clicking the left column, allow, for each option (read, write, and so on)

Just a big thanks to S/Sgt-Reptile on Quakenet who taught me how to fix up PHP into Apache over mIRC (my Internet Relay Chat) and retrospek on Efnet who explained how CHMOD works on Windows. Really, I was clueless since I was working on a network project and I did not want to think about climbing over the big hill of making a web server.

Note - Setting Up Server for Entire Network
If you are running XP with a firewall (Well, I think these are the conditions at least) you need to add an exception to the firewall for port 80 on the Local Area Connection. In the properties dialog for Local Area Connection go to the Advanced Tab > Settings For Windows Firewall. Then in the new dialog, press the "Add Port..." button to add port 80.

- bigmtnskier

If you have any questions or comments, you can reach me on IRC, since I don't frequent the forums alot, at and msg FusioN. This doesn't mean that the forums are void of help, there are tons of geniuses that surpass me way higher than what I sound like! So don't forget to check 'em out if your in need, click the link at the bottom.

page 3 of 3



SUPPORTERS:'s fast and reliable hosting provided by Media Temple.