Installing Apache, MySQL, and PHP on Windows with WAMP (The easy way)
This tutorial explains, step-by-step, how to install Apache, MySQL and PHP on Windows the easy way using WAMP. WAMP is an all-in-one program bundle that includes preconfigured versions of Apache, MySQL, and PHP.
Start off by downloading the latest version of WAMP from the WAMP download page.
A warning message appears warning you not to install with previous versions of WAMP. If you have an earlier version of WAMP installed, uninstall it.c Click yes.
The WAMP setup welcome screen appears, click next.
The license agreement dialog will appear, accept and click next.
Choose your installation directory (Note that Apache, MySQL, and PHP will all be installed under this directory). Click next.
A dialog prompting you to choose what icons to load will appear, choose which icons to load and click next.
Now we are ready to install, verify the information is correct and click install.
After installation, a message box will prompt you to select your default browser for WAMP.
Next, a message box will ask you to install the default WAMP homepage. This will create an index.php in your document root to show that everything is working correctly. If you select yes, you can easily overwrite this file later.
Next, a dialog prompting you for PHP mail configuration will appear. This is for scripts that can automatically send email. If you do not yet have a SMTP server or have one that requires authentication, leave the SMTP server as localhost and you can change it later. Click next.
Now we are ready to launch WampServer. Select Launch WampServer 2 now and click finish.
Notice a icon in your system tray.
Clicking on this icon lets you easily manage Apache, MySQL, and PHP with easy access to important directories and configuration files. It also allows to to stop and start each service or all at once. Especially notice the ‘www directory’ as this is where you can begin to upload your website.
Wamp 2 also includes phpMyAdmin and SQLiteManager which are very useful web applications for managing your MySQL databases.
Conclusion and further reading
WAMP is a great tool that simplifies the process of installing a web server on your windows computer.
Now that all the server software is installed you can start installing web scripts such as Wordpress, Zencart, and Drupal just to name a few.
Installing MySQL 5 on PHP 5 on Windows
This tutorial explains how to install MySQL server and get it to work with PHP.
MySQL is a free database management system that is used by the majority of web applications today. You can install MySQL by itself, but much of its usefulness comes from using it together with PHP.
This tutorial assumes you have already installed and configured Apache web server and PHP.
Start off by downloading MySQL community server from the official website.
Choose the Windows download (Windows x64 if applicable) and select the “pick a mirror” for Windows ZIP/Setup.EXE.
You will be prompted to register with MySQL, you can skip that by clicking the “No thanks” link underneath.
![]()
Select the mirror closest to you and download.
Once downloaded, extract the setup.exe file and run.
![]()
Next you will be prompted to choose the installation type. For this tutorial we will choose typical, which contains all the files and features you should need. Custom lets you pick and choose which items to install and complete includes files that MySQL developers may need. Click next.
![]()
Some more information about MySQL will appear, click next.
After MySQL is done installing we will need to configure our MySQL server. Click finish to start the configuration wizard.
![]()
At The configuration welcome screen, click next
![]()
You will be prompted to choose a configuration type. For this tutorial we will use the standard configuration. The detailed configuration is for setting up servers for specific purposes to increase performance. Click next.
![]()
Next a dialog will prompt the user to install MySQL as a service, this means that MySQL server will run even if no one is logged on (For example, f the computer is sitting at the login screen). It also asks whether to include the bin directory in the Windows path. It is highly recommended you check this option as it makes running MySQL commands from the command line much easier (otherwise you have to change to the MySQL bin directory every time).
![]()
Next you will set a password for the root account. Make sure the “Modify Security Settings” checkbox is checked and enter a password. This is the password you have to supply any time you want to connect to MySQL. It is recommended you not create an anonymous account for security reasons. Click next.
![]()
Now we are ready to apply the configuration settings, click execute. If you have Antivirus or firewall software installed, you may be prompted to allow MySQL to use this port, allow.
![]()
Once completed, MySQL is installed and ready to use. However, PHP may not yet be configured to use MySQL. To test whether it is, open up notepad and type the following lines of code
$con = mysql_connect('localhost', 'root', 'yourpassword'); if (!$con) die('Could not connect: ' . mysql_error()); } else { echo “It Works”; } ?>
Make sure “All files” is selected as notepad likes to save everything with a .txt extension if you have text file selected.
![]()
Save the file as testmysql.php and save it in the document root for your web server (ex: htdocs in the apache install directory). Make sure your web server is running and navigate your browser to http://localhost/testmysql.php.
If you see “It works” on the page, then everything is setup and we are done!
If you see the actual code then PHP is not configured correctly for Apache.
If you see a “Could not connect” message, it likely means you mistyped your password or the MySQL service is not running.
If you see a blank page, it means that PHP has not been configured to work with MySQL.
If you see the blank page, it means you did not check the MySQL item when installing PHP (it is not enabled on the default installation). If this is the case, we have a few more steps to configure PHP.
Open the php.ini file located in your PHP installation directory (ex: C:\Program Files\PHP\php.ini) in notepad or any text editor. Search for the line ‘Dynamic Extensions’ and below that add following line
extension=php_mysql.dll
Go to the download section of the official PHP download page. Download the PHP 5.x zip package (not the installer). Once downloaded open the zip file and find two DLL files: libmysql.dll in the main directory of the zip file and php_mysql.dll in the ext directory.
![]()
Copy both files into your PHP install directory (this is the default PHP extensions directory, search for the line ‘extension_dir’ in your php.ini file to verify where your extension directory is located).
Now that both DLLs are copied and the extension is enabled in the php.ini configuration file, restart Apache either from the icon in the system tray or from the services manager in the control panel.
Try to open the testmysql.php page in your browser again. If you still see a blank page, make sure you followed all the steps and that you copied the DLL files into the right extension directory. If you are still having problems, look at the Apache error log in the Apache logs directory (ex: C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log).
Conclusion and further reading.
Apache, PHP, and MySQL together form a powerful combination. With the three, you can create powerful web applications without any expensive commercial tools. Not only that, but having the three allows you to install useful web applications such as Wordpress, Drupal, and Zencart.
For more information on programming with PHP and MySQL check out our PHP programming tutorials.











