Install WAMP on Windows

The WAMP (Windows, Apache, MySQL, PHP) is tested on the windows 7 with 32bits version and Intel(R) Pentium(R) 4.

System Requirements:

  1. Apache Server 2.2 
  2. PHP 5.3.8  or later 
  3. MySQL Server-essential-5.1.58 or later  
  4. phpMyAdmin

Install Apache

  • Download Apache Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.19-win32-x86-no_ssl
  • Double-click on this file to start Apache installation and click "Run" to continue
  • Install Apache in the folder C:\Program Files\Apache Software Foundation\Apache2.2.
  • Go to browser and typ http://localhost in the adresbalk.
  • You will see something as this: "It works!".

The Apache configuration file "C:\Program Files\Apache Software Foundation\Apache2.2\conf" is stored in the "\ httpd.conf". Apache document root default to the folder "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs". The document root is where all your PHP or HTML files are placed, so that Apache will handle. Of course you can also refer to any folder you want to change. We choose a new folder and in another drive, D:/www.

We have to tell the Apache the new situation. Get the httpd.conf file open with notepad.

Find the following line:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
change to
DocumetRoot "D:/www"

Find the following line:
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
change to
<Directory "D:/www">

To allow .htaccess files chage "AllowOverride None" to "AllowOverride All".

Save the file httpd.conf and close it.

Create a new file "index.html" with the following content:
<html>
<body>
<h1>It works!</h1>
<P>My document root is moved to the directory D:/www. </P>
</body>
</html>

Save this file into directory D:/www.

Restart apache: Start > All Programs > Apache HTTP Server 2.2 > Control Apache Server > Restart and  go to  http://localhost.

Install PHP 5

Go to http://windows.php.net/download/ and download VC9 x86 Thread Safe, ZIP package (php-5.3.8-Win32-VC9-x86) to your computer. Create a new folder called "PHP" in your C: drive and extract to C:/PHP. Find the file php.ini-development' in the C:/PHP" , make a copy and rename it to php.ini. 

Open the php.ini to install some extensions for added functionality.

Find the following line:
;extension_dir = "ext" chang to extension_dir = "C:/PHP/ext"

Find the following lines and uncomment (remove ;) :
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

The first line makes the Image GD library of PHP accessible. The second makes mbstring accessible. The third and fourth make possible to MySQL database to use.

Uncomment also the following lines (change "Off" to "On"):
short_open_tag = On
display_errors = On

short_open_tag tells PHP whether the short form (<? ?>) of PHP's open tag should be allowed.
display_errors determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.

Save & Close php.ini file. 

Is the PHP directory added to the Windows PATH ?

To do this, click Start > My Computer > Properties >Advanced > Environment Variables. Under the second list (System variables), there will be a variable called "Path" (otherwise, click New, type and value of variable name variable = PATH = C: \ PHP;). Select it and click "Edit". Add "C: \ PHP;" to the end of the string and click "OK".

This is needed to exexute PHP commands from any other drive in your computer. You should to restart your computer! 

PHP en Apache Configuratie

We need to tell Apache about PHP and where to find it. Open the Apache configuration file C: \ Program Files \ Apache Software Foundation \ apache2.2 \ conf \ httpd.conf and add the following lines:

Find the following line and uncomment:
LoadModule rewrite_module modules/mod_rewrite.so

Add the following PHP5 lines:
LoadModule php5_module "C:/php/php5apache2_2.dll"
PHPINIDir "C:\PHP"

Find the AddType application/x-gzip .gz .tgz and add the following lines at the bottom:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

How to execute PHP code on an existing index.html page:
AddType application/x-httpd-php .php .html .htm

Find "DirectoryIndex index.html" and add the "index.php" at the end. This line tells Apache which file names to use when searching for a default page of a given directory.
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

Save the file httpd.conf and close it.

Move C:/PHP/libmysql.dll to C:/PHP/ext folder.

Restart Apache for the changes to take effect: Start> Programma's> Apache HTTP Server 2.2> Control Apache Server> Restart.

To test PHP installation create a new file, name it as phpinfo.php and place in the document root directory (D: /www). The contents of this file is shown below (PHP test script):
<?php
phpinfo();
?>

Test: http://localhost/phpinfo.php

Install MySQL

Make sure that the MySQL.com installer file (mysql-essential-5.1.58-win32.msi) matches your system and PHP version. Download and install it. MySQL is now installed on drive C: / Program Files / MySQL /. During the MySQL installation, a password required you should to enter a password and remember it.

  • Enable TCP/IP Networking
    [-/] Add firewall exeception for this port
  • InnnoDB Tablespace Settings
    D:\www\MYSQL Datafiles\
  • Install As Windows Service
    Service Name: MySQL5
  • Modify Security Settings
    New root: _____________
    Confirm: ____________
    [-/]Enable root access from remote machines

Open DOS-windows by Start> Programma's>MySQL>MySQL Server 5.1>MySQL Command Line Client and enter your password. As well, the dos window ready to enter mysql commands.

Test your MySQL server:

mysql>show databases;
mysql> use test;
mysql> CREATE TABLE myTable (
-> id int primary key auto_increment,
-> myname text
-> );
mysql> INSERT INTO myTable VALUES(NULL,'fy');
mysql> SELECT * FROM myTable;
+----+--------+
| id | myname |
+----+--------+
| 1 | Jan |
+----+--------+
mysql> quit

Test your MySQL by the browser. Create a file testMSQL.php and save to D:/www/.

Test: localhost/testMYSQL.php
ID: 1
Name: fy

Install phpMyAdmin

To manage MySQL database from a web browser we will use phpMyAdmin. Go to phpMyadmin  download page and extract the .zip file into D:\www\phpMyAdmin.

Open the config.inc.php file (make a copy of the file config.sample.inc and rename it to config.inc.php) en change or add the following lines:

Restart your Apache!

Test: localhost/phpMyAdmin/

Links

  1. Downloading the Apache HTTP Server
  2. PHP.net - How to change configuration settings