Installing PHP


  1. Overview
  2. Installing Apache
  3. Installing PHP
  4. Installing MySQL
  5. Other stuff
  6. Copyright / Misc.


First things first:
This tutorial will show you how to install Apache2 with PHP5 and MySQL in the intention to use it for DEVELOPEMENT!

We will need Apache, PHP and MySQL.
Apache's newest version for Windows is 2.0.58(recommended) and 2.2.2
Download (Download the .msi install package)
PHP's newest version is 5.1.4 Download (Download the zip package & the PECL modules collection)
MySQL's newest version is 5.0.22 Download (Download the one described as "Windows (x86)")


Installing Apache

The .msc installer makes this easy. Run the installer:



If the fields weren't filled-in automatically filled-in you'll have to fill them in yourself.
The option "for All Users..." should be selected


Click on Change...

I've set my path to C:\Server ... feel free to set it to whatever you like
I might add that the install always creates a folder called "Apache2" so you don't need to add a "apache" folder.
If you do you'll end up with a path like "C:\Server\Apache\Apache2".
NOTE: The problem with the path has been fixed in Apache 2.2.2. Install it in C:\Server\Apache2!


Wait a bit.


Ok now we'll check if if you'd done it right. A handy tool should have been installed with the server. It's a feather-like icon on the task bar. Right-click and select "Open Apache Monitor".

If the icon next to "Apache2" is green then apache should be running.
Now visit
http://localhost/ (or

You should see somethikng like this:

It works!

Ok now we'll change a few settings to move the folder in which the web files are stored - the Document Root. (this part is optional but it makes it make things easier).

You have to make sure thet the folder you specified exists and restart apache. Just open thae Apache Monitor and click on "Restart".


Upgrade Apache

Just Go to Control Panel -> Add or Remove Programs, find Apache and uninstall it. I recommend you to re-do the httpd.conf editing.
Delete your old Apache folder.
Follow the
Apache installation guide to install the new version.
If you had PHP installed you'll have to copy some files to your Apache directory, as described in the PHP installation guide.
If you have decided to use Apache2.2.2 you'll have to take the additional
Apache2.2.x PHP installation step.

Installing PHP

This part of the tutorial assumes you have Apache2 already installed.

After downloading the two zip files extract the first on (the one WITHOUT "pecl" in it's name) to C:\Server\ (You can choose wahtever folder you like but it's a good idea to have it all in one place.

After extracting it and rename the folder to "php".
Now Extract the second .zip file to C:\Server\php\ext\. Just copy everything.

Go back to C:\Server\php and rename the file "php.ini-dist" to "php.ini"
Edit the php.ini:

Now you have to install PHP with Apache.
First you'll have to Stop Apache. To do that open the Apache Monitor and click on Stop.

Now go to C:\Server\Apache2\conf and open httpd.conf

Now move to C:\Server\public_html and add a file named "phpinfo.php" with the content:


Copy the files shown on the image to C:\Server\Apache2\

If you installed Apache2.2.x you'll have to do this aswell:
PHP's php5apache2.dll was made to work with Apache2.0.x only. You'll need to get the right file and unless you want to compile it yourself you'll have to
download it. You'll have to follow the instructions in the readme file that comes with the zipfile. Omit everything after

# Add to your httpd.conf

Do NOT do what is written below that line. You have already done it.

Start Apache by opening the Apache Monitor and clicking start.

If you see messages "Module cannot be found" (you shouldn't) just find the module in php.ini and add a semicolon on the beginning of the line.
If PHP was installed correctly the status bar should show something like this:

Apache/2.0.58 (Win32) PHP/5.1.3

Now visit http://localhost/phpinfo.php (or
If you see information about your PHP install everything should work.


Upgrade from PHP5.1.2

Remove the whole PHP folder. The only thing you might want to backup is your php.ini.
Remove the selected files from your Apache directory.

Follow the
installation instructions up to the point where php.ini is edited. If you've backuped your php.ini you can just copy it to the php folder. You should check the extensions part though as these might have changed.


Installing MySQL

Just pretty much follow the images. Mind the comments below some images.


Custom install...


Let's change the path to C:\Server\MySQL so everything is in one place.

Ok then Next...


Skip this unless you really need to do that...

Installation complete. Now we need to configure the server.
Make sure you've checked the checkbox.

You can change the path if you need to. But you don't have to.

Probably the most important config screen.
You should check "Enable TCP/IP networking" checkbox but there is some risk involved. You should make sure that nobody will connect to that port except for you.
THe second checkbox is also imprtant. If you plan to write SQL which is not as strict or if you're using PHP software which has poorly written queries (vbulletin has problems) you should uncheck it. But you should leave it checked as you should write your SQL correctly.

Check both.

Here you can set the root user (It's something like the server admin if you didn't know) password. You can set it to whatever you like or uncheck the "Modify Security Settings" checkbox.
This will allow you to connect with "root" as the user and an empty string as the password. It's not secure but if no one else connects to you server (nobody should - it's a developement servers) it'll make life easier.


Now to test it.

This part assumes you have a Server with PHP installed.

Download phpMyAdmin from
Extract the file to your you Document Root\pma (C:\Server\htdocs\pma for example).
Edit "config.default.php" located in the pma folder.

That would be it. Now visit http://localhost/pma/ and if don't see any error it works.


Other stuff

Zend Optimizer

Zend Optimizer is a program the speeds up execution of PHP code and enables you to use code encoded by Zend Guard. Hosts usually have this installed.
Zend Optimizer's newest version is 3.0
Download (Windows x86 version) You'll need to register on if you haven't already.
The installation is very simple. Just run the installer.


Agree. Next.

Set the path to C:\Server\Zend\Optimizer so that everything will ordered nicely. You can set it to anything you like though. Next.

The installer should detect your Apache2 install automacily. If not select Apache 2.x and click on Next.

If you have followed the whole guide you should have you php.ini in C:\Server\php. If not, then you should set it to the folder in which you keep you php.ini.

This should be detected by the installer. If you have followed the whole guide it should be C:\Server\Apache2.

Again if you have followed the whole guide your document root should be C:\Server\public_html

Install. You will be asked if the install is allowed to stop you server. Agree.

Wait untill your server stops, starts and the install finishes.

Finish. Done!


Copyright / Misc.

Everything was made by Marek_mar. - Feel free to contact me if you have any suggestions or have spotted any errors.
Hosted by a friend, Owner of

04.05.2006 - Updated the guide as Apache, PHP and MySQL got updated. 23.04.2006 - Added the Zend Optimizer part of the guide.
22.04.2006 - Changed the extension part of the guide. It matches PHP5.1.2 extensions available from PECL. Added the "All webserver" category which has all extensions except those that are useless/harmful. The extensions are collapsed becouse they took up too much space.

I won't take any responsibility for the damage you might couse by using this tutorial. I will happily fix any errors.