Breadcrumbs
Too Easy WAMP Setup
- Author
- Date
- Sun 23 Oct 2005 at 13:36
Note: This setup will configure PHP as CGI, not an Apache module.
PHP
Last, you have to install PHP. This is the most difficult part of your WAMP setup, as you will not be using an installer. Doing this installation manually allows you to have more control over the settings, and it is the recommended method.
To start, you need to download the zip file containing PHP from its download page (external link). Download the PHP x.x.x Zip Package from the Windows Binary section. At the time of this writing, the latest version is 5.0.5. After the file has downloaded, unzip the contents of the zip file to C:php (or another hard-disk you want to install PHP on).
Now, we are going to setup php.ini, PHP's settings file. First, we need to make the recommended settings the ones that we use as our base. In PHP's root directory, there is a file called php.ini-recommended. Rename this file by removing the -recommended part out of the filename. Next, open the renamed file in Notepad.
The first setting we are changing will make PHP display all errors that it encounters. Search for the string "display_errors"; the fourth match should be the line we need (display_errors = off). Change this setting from off to on.
Next, we need to make PHP use the MySQL extension. Search for "Windows Extensions" and then scroll down until you reach this line:
;extension=php_mysql.dll
Simply remove the ; from the start of the line, so that it reads:
extension=php_mysql.dll
Save and exit the file.
Now, we have to move the extensions. This is simply a case of cutting and pasting all the files out of the /ext/ directory and into PHP's root folder (C:/php).
Note: If you are not using the C drive then make sure that you change the letter in the first line to the appropriate drive.
We are now done configuring PHP itself. Next, we need to configure Apache to use PHP. To do this, we need to edit Apache's configuration file, which can be found at C:Program FilesApache GroupApache2confhttpd.conf (if you chose to install it in the default directory). Open the file in Notepad and scroll down to the bottom of the file. Add these three lines to the file:
Code: Apache
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"We need to configure Apache to use index.php files as folder roots. Still in Apache's configuration file, search for "DirectoryIndex"; the second match should be the correct line. Add index.php onto the end of the line so that it reads:
Code: Apache
DirectoryIndex index.html index.html.var index.phpSave and exit the file. Restart Apache to finalize the setting changes. To restart Apache, double click on the Apache monitor icon, that was mentioned earlier. Highlight the Apache2 service and press the Restart button on the right hand side.
Crank It Up! - Testing Your WAMP Setup
First, we will test if the actual web server works. Open up your web browser and type http://localhost into the address bar. This should take you to the Apache introduction page. If you see this page then the web server is working fine. Otherwise, check that the Apache monitor shows that Apache is running.
Testing PHP is simple as well. Navigate to C:Program FilesApache GroupApache2htdocs and create a new PHP file called phpinfo.php in Notepad. Edit the file and add this simple code:
Code: PHP
<?php
phpinfo();
?>
Note: Note: Make sure that you save the file with the .php file extension, rather than .txt.
Now, go to http://localhost/phpinfo.php in your web browser and you should see a multitude of tables. These show the various PHP settings, and as long as they are there PHP is running fine. If you see the raw code, not the output, then you need to make sure that you correctly setup Apache for PHP.
Testing MySQL requires another simple script. Create another PHP file called mysqltest.php, and within it place this code:
Code: PHP
<?php
$connection = mysql_connect('localhost', 'root', '');
echo (!mysql_ping($connection)) ? 'Unable to connect to MySQL.' : 'MySQL successfully setup!';
?>
Note: Make sure you set the password to the password you set up in MySQL's configuration utility. If you didn't set up one, then leave this blank.
Run this script in your web browser. If you see the text "MySQL successfully setup!'" then congratulations, you have a fully working development server now. Otherwise, you will have to backtrack and make sure that you uncommented the MySQL extension in the php.ini file.

