Download Apache, MySQL and PHP
– If you don’t have MySQL and want to install fresh – skip to “Upgrading MySQL”
– If you already have a version of MySQL and don’t want to change you can skip this step.
– If you already have a version of MySQL and WANT to upgrade follow these steps:
– Open the command prompt and type the following command to backup all of the MySQL databases:
where <username> and <password> are your adminstrator’s username and password and path-to-backup> is the backup filename
– Make sure this file is saved somewhere safe and obvious because we will need it later
– Now remove MySQL by opening control panel > add remove programs and selecting your version of MySQL
- Run the installer and choose “Complete installation”
- Afterubg signing up to MySQL, choose “Configure your server now”
- Choose “standard configuration”
- Ensure that the Install as Windows server, Include Bin Directory in Windows PATH and Launch the MySQL Server automatically options are checked and that the service name is MySQL. These options ensure that MySQL starts up automatically as a service when your machine boots, and that you can run the mysql programs without navigating to their directory. Enter a password to access MySQL as an administrator. Caution – Do not check “Enable root access from remote machines” unless you know what you are doing.
- Choose execute. If you experience any problems at this point, it is likely that you have an antivirus or firewall application that is blocking the connection to port 3306. To remedy this, you need to allow mysql access. Refer to your particular Antivirus solution to find out how to do this.
Restoring the pre-upgrade data
– Open the command prompt and type the following command to restore your MySQL backup:
mysql -u<username> -p<password> < <path-to-file> (e.g. mysql -uUser -pPassword < c:\mysqlbackup.txt)
MySQL is now installed and restored!
- Run the apache installer
- Enter ‘localhost’ for the “Network Domain” and “Server Name”
- Enter your email address for the “Adminstrator’s Email”
- Choose a typical installation and choose install. Again, Windows firewall or your antivirus-may block apache from connecting to a port. Choose unblock or manually change the antivirus settings to allow apache to connect.
- If all went well, open up a browser and navigate to “http://localhost”. If you see a “It works!” then Apache is setup and ready to go!
- Unzip the PHP download to something like c:\Program Files\PHP. I will assume that this is the directory you have used from here on.
- Navigate to C:\Program Files\PHP
- Copy the file “php.ini-recommended” and name the new file “php.ini”. This is the configuration file for PHP.
Note: In the configuration file, any line beginning with a semi-colon ‘;’ is ignored and treated as a comment. Removing the semi-colon activates the command.
– If you would like PHP to display errors (useful for debugging) change the display_errors command to
– To allow PHP to connect to MySQL you need to allow the MySQL extension, remove the preceding semi-colon’s from these two lines:
and set extension_dir to:
Now move this file into the Windows directory i.e “C:\Windows\php.ini”.
Configure Apache to use PHP
– Open <path-to-apache>\conf\httpd.conf (i.e. C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf) and add the following lines to the end of the file:
# Load PHP5 module
LoadModule php5_module “C:\Program Files\PHP\php5apache2_2.dll”
# Tell apache about the PHP file type
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir “C:\Program Files\PHP\”
– Navigate to <path-to-apache>\htdocs (i.e C:\Program Files\Apache Software Foundation\Apache2.2\htdocs)
– Create a file called index.php in this directory and enter the following code:
echo “<h1> Hello, i’m a PHP file! </h1>”;
Restart the Apache service by clicking on the little Apache icon in the system tray and choose ‘restart’.
Open a browser and navigate to “http://localhost/index.php” and you should see a message saying “Hello, i’m a PHP file”
You have now installed a WAMP on your machine!