In the third part of this tutorial, we’re now going to install PHP 5 on Windows.
In the two previous posts, we’ve seen how to install Apache and MySQL on a Windows computer so you you should already have a working web server and database server.
How To Install PHP5 On MS Windows
- Head over to http://www.php.net and download the latest version of PHP from the “Downloads” section. From the Windows Binaries, get the zip package, not the installer. The latest version at the time of this writing is PHP 5.2.6.

- Extract the content from the archive into C:\PHP (or wherever you want to install PHP but at the root of your hard drive the preferred location).

- Using Notepad (or any non-formating text editor) open Apache’s configuration file (c:\Apache2\conf\httpd.conf)
- Find the section where modules are loaded and insert the following lines:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
- Now find the DirectoryIndex parameter and index.php so it looks something like this:
DirectoryIndex index.php index.html index.html.var
- Save and close the httpd.conf file.
- Copy c:\php\libmysql.dll and c:\php\libmcrypt.dll to c:\windows\system32
- Using Windows Explorer, find the file named php.ini-recommended in C:\PHP and rename it to php.ini (ie.: c:\php\php.ini).
- Open php.ini with Notepad.
- Uncomment the line that begins by “include_path” under the Windows comment.
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes"
- Find the extension_dir parameter and set it to:
extension_dir = "c:/php"
- Find the mysqli extension parameter and uncomment it:
extension=php_mysqli.dll
- Do the same thing for extension=php_mbstring.dll and extension=php_mcrypt.dll
- Right-click on My Computer and select Manage. Restart the Apache2 service as shown below.

- Using Notepad, create a new file and insert the following content:
<?php phpinfo(); ?>
- Save this file to c:\Apache2\htdocs\phpinfo.php
- Open your web browser at http://127.0.0.1/phpinfo.php
- If everything went correctly, you should see the PHP information page:

You now have a functional web server with PHP and MySQL support running on your Windows computer!
But it’s not over yet. We still need to do a few things:
- Create a MySQL database and a database account
- Create a virtual host
- Install phpMyAdmin so you can manage your database content and structure
Stay tuned, I’ll be posting the final part of tutorial soon.
Click here to subscribe in a RSS reader or to receive email updates.
1 response so far ↓
1. Response by : How To Install Your Own Web Server - Adding A Virtual Host on Jun 10, 2008 at 5:13 am
[...] Restart the Apache2 service (Don’t remember how? See step #14 from this post). [...]
Leave a Comment