How to Setup Apache PHP MySQL on window 7

By Neeraj Singh | Updated: Dec 07, 2019 | Views: 646
Quickly setup WAMP development environment on Window 7 in few simple steps. Configure Apache for PHP script and PHP for MySQL database.
Setup Widnow 7 Apache PHP MySQL
Many of us migrate from one development environment to other. I wanted to shift to Apache 2.4, PHP 5.6 and MySQL 5.7 for acquiring more freelancing jobs. I had developed a web framework for Web apps and mobile apps on Microsoft ASP.NET 4.0 on Windows 7, as I was a student of that technology and was very comfortable with that.

At that time I was working for an organization and used to develop websites, e-commerce and search engines. After some time I started to work as a freelancer and in India, I found it difficult to get enough number of jobs on ASP.NET. I searched upwork, indeed,, and many more job sites which outsource jobs to freelancers. I found that 80-90% of jobs were on AMP (Apache, MySQL and PHP) technology. So, I tried to setup an environment on my Window 7 workgroup.

I had not worked with Apache web server, but it was not difficult to learn as I had worked with IIS 7.0. I wanted to setup a fresh Apache web server, but I also wanted the IIS 7.0 working on my machine. There were many packages which offered easy and integrated setup like WAMP, XAMP etc. but I wanted to learn the process and hence went on to step by step installation of the three.

How it worked
I have tried steps in different orders, but I will let you know the easiest and appropriate order of installation.

Pre requisite to Setup WAMP environment

You will require Service Pack1 on your Window 7 and JRE (Java Runtime Environment 1.8 or above) installed on your machine. Your machine shall have Microsoft C++ distributable 13 or above installed on your machine as well. This distributable is required to setup PHP 5.6 and MySQL 5.7.

Setup Apache 2.4

Download zip file from and unzip it. You will find a file httpd (an application). Execute it by double clicking and your apache web server is instantiated and running. If IIS was running, the Apache may fail to start.

Stop IIS Server: In this case, you stop IIS server or disable it temporarily. You can stop IIS server by executing the following command from command prompt: iisreset -stop and IIS service will stop. Alternatively, you can stop it from Internet Information Services Management console where you select Stop from the manage server panel.

Once IIS service is disabled or stopped, execute httpd application and your Apache service will be ready as a web server on the default i.e. port 80.

Now open your browser, and browse http://localhost and you will get It Works! Wow! You are ready with your Apache web server.

Important Info: The default document folder is Apache24 > htdocs. Here you will find the index.html which displayed the message above. Now insert few lines of PHP script and it will give you an error. This is because Apache is not yet configured to run PHP scripts.

Install PHP 5.6

Download PHP 5.6 from Please remember to download and expand the thread safe version. Expand the zip file into php5 folder. Now, it is time to configure Apache to allow running PHP scripts.

Configure Apache to run PHP script

Open Apache base folder. In conf folder, open the configuration file httpd.conf file in any editor. Go to the end of LoadModule section and add line:
LoadModule php5_module "c:\php5\php5apache2_4.dll"

Now, save file and restart your apache server. Add PHP script in the index.html. Browse http://localhost  and viola! Your PHP script is in action.

Now, it is time to do some database connection and data retrieval. Without this, building any meaningful application is not possible. Here, we are going to be working with MySQL 5.7. 

Setup MySQL 5.7

Download MySQL 5.7 from Choose appropriate installer. If you have internet connection, you can install it from online installer or you can download offline setup file for both x86 and x64 machines. Setup MySQL 5.7 as window service. Run the installer application file, follow instructions and configure it the way you like. I would recommend installing as the developer machine so that service and client tools are installed on your machine and moderate use of memory is ensured. If you install it a dedicated server service all the resources will be prioritized for use by MySQL and other services will start to suffer.

Configure PHP to use MySQL 5.7

First you have two file php.ini.development and php.ini.production. Rename one of those to php.ini as the configuration file that will take effect. Now, Open php5 > php.conf in notepad and locate for the line with [extension_dir] next to "; On Windows:". Remove semicolon and appropriately set the extension_dir=”ext” here. This setting is required because all the support DLL files to connect with MySQL is available in the folder php5 > ext.
Now uncomment extension=php_mysqli.dll and extension=php_pdo_odbc.dll line (Remove semicolon as commen lines starts with ;).

Now, you have successfully configured your server environment to build medium to large web applications using PHP and MySQL over Apache on Window 7 platform.

After this setup process is completed, further configuration can be done as required by your application. The only thing you need to remember is that stop IIS 7.0 web server before launching Apache server 2.4 either through command prompt or IIS management console. I personally prefer using command prompt as it is a quick method.

I hope this blog post is useful for you. Please share this article or subscribe to us to receive new articles articles and updates from The Slip Post.