# Installing and configuring Apache, MySQL and PHP on Windows

I did this on Windows 8.1 64 bit

### Apache

Extract the contents of the zip to the drive you want Apache to run on, in my case this was C:

I wanted to change the port that Apache runs on, as I have IIS running on port 80. So I edited C:\Apache24\conf\httpd.conf and changed Listen 80 to Listen 8080. I also specified the server name, in my case as my machine name, e.g. ServerName Yoga:8080

Install Apache as a Windows Service. Open a command prompt

cd C:\Apache24\bin
httpd.exe -k install

Test this in your browser, http://localhost:8080 - this should return a page with the text It works!

### PHP

Create a folder for php e.g. C:\php and extract the zip contents into that folder

After the php package has been extracted, copy the php.ini-production as php.ini in the same folder.

edit php.ini

find extension_dir, uncomment it and set the path to your php installation

extension_dir = "C:/php/ext"

Uncomment the following 4 lines in php.ini so that php can use MySQL

extension=php_mbstring.dll
extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll


Got back to your apache configuration file, httpd.conf and modify it to use php. At the end of the LoadModule lines add

LoadModule php5_module "C:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php

Add the following to httpd.conf to tell Apache where to find php.ini

# configure the path to php.ini
PHPIniDir "C:/php"


### Test

In the folder C:\Apache24\htdocs create a file called test.php, and put the following in it

<?php
phpinfo() ;
?>


The run the file in your browser, http://localhost:8080/test.php

You should see a page describing the properties of your php installation. If you do that's great, take a coffee break !

### MySQL

C:\mysql\bin
mysqld --install
    C:\mysql\bin