How to Install Apache, PHP, and MySQL on Windows?
This article will teach you how to set up Apache HTTP Server, MySQL and PHP on the Windows operating system. To develop dynamic web pages these are a common set of applications used. For people who would like to learn the basics quickly so they can go explore on their own that’s the reason this tutorial series was developed. As with all tutorials, before following the instructions I recommend reading the whole tutorial.in
Apache HTTP Server is the web server that will be used to process all web requests. Static files such as images or basic html pages would be supplied. If Apache sees a request for a PHP file, it will pass the file to PHP. PHP will be used to process PHP code and create the dynamic web pages. MySQL is the database we will use to store and retrieve data.
First we have to decide which version of each application will be installed. To some degree, each version of PHP depends on a specific version of Apache. Since this is a beginning of the tutorial, to get you going I have already selected compatible versions. Here I choose the following 32-bit versions for you:
Apache 2.2.24, MySQL 220.127.116.11 & PHP 5.2.17
Installing and Testing Apache HTTP Server
Download the Apache Server from Apache Lounge:
Unzip the server software
- Right click on the zip file and then click ‘extract all’
- The extracted Apache2 folder to must be moved to c:\
Configure Apache HTTP server by editing the configuration file
So you are now going to make some changes to the Apache configuration so that your web server is only accessible on your local system and not cannot be accessed to your local area network or the internet.
- First edit the file c:\Apache2\conf\httpd.conf
- Then on line 47, change ‘Listen 80′ to ‘Listen 127.0.0.1:80′
- Change ‘#ServerName www.example.com:55′ to ‘Server Name 127.0.0.1:80′ on line 173.
- After finishing the above steps save the file.
Starting the Apache HTTP Server
- Run ‘httpd.exe’ (this is the web server executable) which can be found in c:\Apache2\bin
- If httpd.exe fails with the error ‘MSVCR100.dll is missing’ you are missing some software the Apache depends on. Download the following and install it.
- Then again run ‘httpd.exe’. Then if it fails, let me know what the error is and I will help fix it and list it here
- Note: When you want to connect to your webserver this executable needs to be running.
Test your Apache HTTP Server installation
- In a web browser, browse to http://127.0.0.1
- You must see ‘It works!’ being served from the Apache server.
Installing MySQL Community Edition 32 bit
Download the MySQL installer.
- Browse to http://www.mysql.com/downloads/installer/5.6.html
- Here select the Windows (x86, 32-bit), MSI Installer
3. Then the page will redirect you. Select ‘No thanks, just start my download.’
- Run the mysql-installer-community-18.104.22.168 installer.
- You may be presented with a message about installing .NET Framework 4.0 after starting the installation, If yes then install it from here http://go.microsoft.com/fwlink/?LinkId=181012
- Select “Install MySQL Products” when you make it to the welcome screen
- Then accept the license.
- After these steps their next window would be poorly designed it looks like two selectable radio buttons, but they aren’t. Just click ‘Execute’ and then the installer will make sure it has the latest data that it needs.
6. You will select the type of installation next.
- Just take note of where the default installation path and data path should be fine.
- I decided to select the ‘custom install’ after some playing around.
NOTE: The default installation had some dependency issues on Excel so I choosed ‘custom install’. I don’t have any need for integration with Excel, nor will you if you are following my tutorials. So then you will have an opportunity to turn off after selecting next.
- With the feature selection present, select ‘applications’, then uncheck ‘MySQL for Excel 1.1.1′ then select next.
- You will then be presented with a dependency checklist of software that will be installed. Select ‘Execute’.
7. Just click ‘Execute’ after the MySQL software installation list will be presented to you.
8. Initial Configuration of ‘MySQL Server 5.6.11′
- Check ‘Show Advanced Options’ after the default values are okay.
- Config Type: ‘Development Machine’ is okay
- ‘Enable TCP/IP Networking’ is checked or not
- Check the ‘Show Advanced Options’
- Then click ‘Next’
9. Account configuration
- First set the root password (Make sure it is something you remember!)
- Here you don’t need to create any user accounts right now.
- Then click ‘Next’
10. Windows service details
- Pick a windows service name ‘MySQL36′ is okay
- You must make sure that ‘run windows service as a standard system account’ is checked.
11. Logging options
- Default options must be used here.
12. Finish configuration
13. After setup start the MySQL Workbench
- Then under ‘Open Connection double click the Local instance connection to Start.
- You see the following screen if successful
Starting and Stopping MySQL
1. Run ‘net start MySQL36′ at the windows command line to start the MySQL service: Where MySQL36 is the name you chose in section 10.1
2. Run ‘net stop MySQL36′ to stop MySQL where MySQL36 is the name you chose in section 10.1
Installing and testing PHP
Download the thread safe PHP 5.2 windows installer.
Run the installer
- Run the installer that you just downloaded.
- Then accept the license.
- Select your installation location as: (C:\Program Files (x86)\PHP\)
- Then select the ‘Apache 2.2.x module’
- Here select the Apache configuration directory
- Browse to (or enter in) c:\Apache2\conf\
- Under extensions, click on the Red X to change the following extensions to ‘Will be installed on local hard drive’
- That’s it finish installing PHP.
Fix the Apache configuration file.
Due to errors in the configuration file at this point httpd.exe will no longer run. This appears to be an error or a bug in the PHP installer. The configuration values are not been properly installed by PHP. Therefore you need to make httpd.conf point to the PHP installation.
Then open c:\Apache2\conf\httpd.conf
Around line 496, point PHPIniDir and LoadModule to the correct location as seen below:
1.PHPIniDir "c:/Program Files (x86)/PHP/"
2.LoadModule php5_module "c:/Program Files (x86)/PHP/php5apache2_2.dll"
Create and run a PHP file
- Create the file named info.php in c:\Apache2\htdocs with the following contents
2. Now, make sure that you start the Apache server by running httpd again. Do remember that, all the web requests come in to the Apache server, but the php files will be processed by the PHP software.
3. Test your PHP installation by browsing to
Here you should see a page that displays information about your PHP installation.
4. But what happened here? <?php starts a php block?> ends a php block. The phpinfo(); then call makes a call to a php library function and the output of the function is stuffed into the page that you receive.
If this knowledgebase tutorial created by Cloudcandy host was helpful to you, please let us know through e-mail, facebook or skype.
Was this answer helpful?
OpenVZ is the open source version of SWsoft’s popular virtualization software, Virtuozzo....
A package specifies several different values for a cPanel account. For example, you could offer a...
The following tutorial presumes you understand what a LAMP Server is, how to work a website...
Usually, for a website that’s having a large volume of data. Is a must to enhancing the...
CPanel is the only control panel which...
Powered by WHMCompleteSolution