Quick Install Guide for Apache & PHP - for Windows
This is a quick installation guide for Apache and PHP,
running on Microsoft Windows.
Personally, I always keep my web applications out of the default c:\Program Files\ directory,
since the space in the directory name is a hassle, but you are free to install these applications where you like.
This guide assumes you will be installing the software in c:\bin.
Apache 2.x
- Download Apache for Windows from a server close to your location: httpd.apache.org/download.cgi.
- When download is complete, execute the Windowns Installer Package.
- Basically follow the instructions. Note that a directory will be created in the location you specify. Create and choose, for example: c:\bin\. Apache will then be installed in c:\bin\Apache2.
- Browse to http://localhost/. A page saying "It Works!" should appear.
PHP 5.x
- Download the ZIP-version of PHP for Windows: windows.php.net/download/.
- Unzip to c:\bin\. PHP will then be installed in c:\bin\php-5.3.0 (where version depends on your download). This document assumes PHP to be installed in c:\bin\php (so either rename install dir, or substite correct dir below).
- Make a copy of php.ini-dist and rename it to php.ini.
- Open php.ini in your favorite editor and set extension_dir to c:\bin\php\ext.
- Edit Apache's configuration, c:\bin\Apache2\conf\httpd.conf, find the section after the LoadModule's and add these lines:
LoadModule php5_module "c:/bin/php/php5apache2.dll" AddType application/x-httpd-php .php PHPIniDir "c:/bin/php"
- Find the line that reads: DirectoryIndex and add index.php
- Restart Apache (either use the Apache monitor in the Tray, or the option in the Start menu: Start, All Programs, Apache HTTP Server, Control Apache Server, Restart).
- Create a file c:\bin\Apache2\htdocs\phpinfo.php (in Apache's default document root) and add these lines:
<?php phpinfo(); ?>
- Browse to http://localhost/phpinfo.php and watch the magic unfold...
Good luck and happy programming!