Update 12/27/2018: Follow the updated instruction to setup your environment with the latest version of Apache, PHP, MySQL.

Step 1: Install Apache 2.4

bin>httpd.exe -k install
  • Open browser and type “localhost” to see if it works.

Step 2: Install PHP 5.6

  • Download PHP 5.6.3 (VC11 x86 Thread Safe)
  • Extract to C:\php
  • Re-name ” C:\php\php.ini-development ” to “php.ini”
  • Open “php.ini” in Notepad++ and search for extension_dir = “ext” and uncomment it (under on Windows). Then change it to extension_dir = “C:\php\ext”
  • Add the following to C:\Apache24\conf\httpd.conf under #LoadModule xml2enc_module modules/mod_xml2enc.so .For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
  • Add index.php in httpd.conf as below
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
  • Restart Apache
  • Create an “index.php” file and place it in “htdocs”
  • Open it in browser “localhost/index.php” to see if it works.

Step 3: Install MySQL 5.6.21

  • Download MySQL(Windows (x86, 32-bit), MSI Installer)
  • Install MySQL using the default option
  • Open C:\php\php.ini and uncomment as the following
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
  • Check connectivity of PHP and MySQL, create “mysqltest.php” in “htdocs” and open it in browser
<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>