Tutorial : Installing Apache 2.2.11, PHP 5.2.9, MySQL 5.1.34 & PhpMyAdmin 3.1.4 in Windows Vista/XP   Leave a comment

Not everyone would spend money online to buy webspace just so that they can test out how their latest application works, Well… Welcome to Vision Master Designs Blog. This tutorial will teach you to set up a developer environment for PHP/MySQL in your computer in no time.

Index :

If you are aware of the basics then Click Here to jump below, else read on.

Normally we can view HTML pages on our computer without the need of uploading them to the server, since HTML is a Client Side Language. You don`t need any extra software to view html files, just any browser will do the trick.
But if you want to make your pages dynamic using any Server Side Language (PHP,ASP,JSP) & want to the see the results then you must upload the file to the webserver which supports that language so it can execute the file & return the results on your browser

We can set up a developers environment from which you can create and execute PHP/MySQL scripts by installing the above mentioned applications.

Now, The Pre-Requisites :

  1. Apache HTTP Server (2.2.11): The best open source webserver. You need this to turn your humble computer to a powerful webserver to execute your applications.
    Direct Download apache_2.2.11-win32-x86-no_ssl-r2.msi
    Apache Download Page – Please Download the Win32 Binary without crypto (no mod_ssl) (MSI Installer) – apache_2.2.11-win32-x86-no_ssl.msi~ 4.3MB
  2. PHP (5.2.9) : One of the most powerful web programming languages.
    Direct Download PHP 5.2.9 -2 zip package
    PHP Download Page – Download the PHP 5.2.9 – 2 Zip package ~ 10MB
  3. MySQL (5.1.34) : One of the best DBMS packages which is free.
    The latest version is 5.1.34 which is stable and used in production servers. Although MySQL 5.1 and MySQL 6 are also available as beta releases, they are not used in production servers as of now.
    MySQL Download Page – Please download Windows ZIP/Setup.EXE (x86) 5.1.34 ~ 35.2MB
  4. PhpMyAdmin (3.1.4) : Used to manage your MySQL databases directly using your web browser.
    Direct Download phpMyAdmin-3.1.4-all-languages.zip
    PHPMyAdmin Download Page – Please download the latest release from the 3.x rooster.

The above downloads are compatible with Windows Vista/Vista SP1 (32 bit OS).



    Create Directories

  1. Firstly lets make the required Directories. Create a ‘New Folder’ and rename it to ‘Server’ in your C: Drive. Inside the Server folder, create folder called ‘www’ and inside www create ‘myserver.dev’ and then finally create ‘public_html’ folder inside your myserver.dev
    Follow this structure -> ‘C:\server\www\myserver.dev\public_html’
    This is where you will be putting all your html,script etc files to be accessed by your webserver.
    The following picture shows how the directory structure must look.
  2. Php code and Directories

    Follow the directory structure as shown in the above picture. Also create PHP file, name it ‘index.php’ and put the following code in it and save it.

  3. Open up notepad, type in the following code and save the file as index.php inside C\:server\www\myserver.dev\public_html as shown in the above picture.
    1.< ?php//index.php

    Install Apache

  4. Now install Apache, follow the instructions, accept the license then input the following settings as shown in the image below and donot modify anything after that, just keep clicking on next for the rest.

    Apache Settings

    Settings while installing Apache

    Apache Settings 1

    Settings while installing Apache

  5. Now type http://localhost/ in your web browser. If you get a message saying It works!, then it Works. Congratulations !

    It Works !

    It Works !


STEP 2 : Install PHP 5 and configure PHP.ini

    Extract PHP package

  1. Now to install PHP5. Open the zip file & Extract all your files to ‘C:\server\php’, as shown in following the image.

    Directory Structure

    General & PHP Directory Structure. Rename php.ini-recommended to php.ini

  2. Modify php.ini file

  3. Search for the file ‘php.ini-recommended’ and rename it to ‘php.ini‘. See the above image for reference.
  4. Open up php.ini using any text-editor. (Notepad, Wordpad, Preferrably Dreamweaver)
  5. The following part involves searching a given line and either editing it or replacing the line with a new line.

    Search the code given inside these types of boxes.
    Replace/Add the code given inside these types of boxes.
  6. Search for
    extension_dir = "./"

    and replace it with (Please note the slashes)

    extension_dir = "C:/server/php/ext"
  7. Search for the following lines individually. After you find them, remove ‘;‘ from each one of them.

    Remove the ; from all these lines. ; is used to comment out these extensions from being used.
    The First extension enables the Image GD library of PHP.
    The Second enables mbstring.
    The Third and forth enables us to use MySQL database.

  8. Save the php.ini file.
  9. Adding Environmental Variables in the System path

  10. Great ! Now we have to add tell the computer to start php everytime the computer reboots. So, Navigate to your Start->Control Panel->System->Advanced System Settings then go to the advanced tab, Click on the Environmental Variables button, then scroll down in system variables to find PATH, Edit it Add the following Code to it, as shown below in the image.

    Environmental Variables

    Environmental Variables

  11. Click Ok all the way and reboot your system.
  12. You MUST MUST MUST reboot a windows box after setting the Path variable (step 2). If you move on past that point without rebooting – logging off is NOT enough – apache will have trouble finding your mySQL extensions. Your phpInfo will not show those extensions and you’ll get an error in the apache log saying it can’t find the extension.
  13. Finally, Step 2 is over !. Now we have PHP configured. Lets move on to configuring Apache.


STEP 3 : Configure Apache 2.2

  1. Now navigate to
    C:\Program Files\Apache Software Foundation\Apache2.2\conf
  2. Open & Edit httpd.conf

    Some users had reported that they weren`t able to edit httpd.conf in VISTA using Notepad. Try using Dreamweaver or any other editor to edit the *.conf files. If you are still not able to open httpd.conf file in any text editor, you can try the following solutions

    1. Try different text editor
    2. Stop Apache server from the taskbar and then try to edit
    3. You should have administrative previliges. Try disabling UAC
    4. If none of the above work. Reboot your computer in safe mode and then try to edit httpd.conf

    The above is applicable for all *.conf files

  3. Open httpd.conf
  4. The following part involves searching a given line and either editing it or replacing the line with a new line.

    Search the code given inside these types of boxes.
    Replace/Add the code given inside these types of boxes.
    1. Search for
      #LoadModule rewrite_module modules/mod_rewrite.so

      Replace it

      LoadModule rewrite_module modules/mod_rewrite.so
    2. Add these lines immediately after the previous step.
      LoadModule php5_module "C:/server/php/php5apache2_2.dll"
      PHPIniDir "C:/server/php"
    3. Search
      AddType application/x-gzip .gz .tgz

      After that add

      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps
    4. Search for this line
      DirectoryIndex index.html

      Replace it to

      DirectoryIndex index.html index.php
    5. Search
      #Include conf/extra/httpd-vhosts.conf

      Replace with

      Include conf/extra/httpd-vhosts.conf
  5. Final Changes in httpd.conf

    This is the finished product of httpd.conf

    Open & Edit httpd-vhosts.conf

  6. Now navigate to
    C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra
  7. Open httpd-vhosts.conf
  8. Replace all the previous code with the following.
    01.<virtualhost *:80>
    02.DocumentRoot "C:/Server/www/myserver.dev/public_html"
    03.ServerName myserver.dev
    05.<directory "C:/Server/www/myserver.dev/public_html">
    06.AllowOverride All
    07.Options Indexes FollowSymLinks
    08.Order allow,deny
    09.Allow from all
  9. Adding myserver.dev in hosts file

  10. Finally navigate to C:\Windows\System32\drivers\etc
  11. Open up hosts in notepad/wordpad/dreamweaver any text editor and add the following	myserver.dev	www.myserver.dev

    edit hosts

    Edit the Hosts file

  12. Restart the Apache Webserver. If you have followed perfectly you`ll see that Apache has restarted perfectly.
  13. Apache 2.2.11 + PHP 5.2.8 in harmony

    Apache 2.2.11 + PHP 5.2.9 in harmony

  14. If Apache has restarted successfully then lets move on to the next step, i.e Installing & Configuring MySQL5


STEP 4 : Installing and Configuring MySQL5

  1. Lets start by unpacking the zip & start the installation. Select Typical, click Next

    MySQL 1

  2. Click Next after reviewing where you are installing

    MySQL 2

  3. Skip the Sign-up.

    MySQL 3

  4. Install SQL, Now time to configure SQL. Its pretty simple, if you follow the onscreen instructions.


  5. Now just follow the following images.

    Instance Wizard Start

    Instance Wizard Start

    Detailed Configuration

    Detailed Configuration

    Developer Machine

    Developer Machine

    Multifunctional Database

    Multifunctional Database





    Enable TCP/IP Working and PORT no

    Enable TCP/IP Working and PORT no

    Standard Char Set

    Standard Char Set

    MySQL As Windows Service

    MySQL As Windows Service

    User Name and Password = root

    User Name and Password = root



  6. Finally click on Execute and let mysql configure everything.

    During the MySQL installation and configuration,if you have missed any step or have not configured properly, then you can run the MySQL Server Instance Config Wizard which can be accessed via ‘Start->All Programs->MySQL’.
    *If MySQL Instance Wizard does not complete the final step, reboot your computer and configure again.*

  7. Now to test whether mysql & php along with apache are working fine, restart the webserver, i.e click on the apache icon in your taskbar (near time in the taskbar/startbar) and restart the webservice.
  8. After it has restarted (green play icon will be displayed), point your favourite web browser to http://www.myserver.dev.


  9. If you are able to see the above page, then you have successfully configured Apache+PHP5. To verify whether MySQL5 has been installed, scroll down the page until you come across mysql & mysqli heading as shown below.

    Apache + PHP + MySQL

  10. Woohoo ! Congratulations ! You have successfully installed Apache2.2.11+PHP5.2.9+MySQL5.1.34 on your system. *sigh*


STEP 5 : Installing and Configuring PhpMyAdmin 3

    Extract the PhpMyAdmin 3 package

  1. Finally the last step in this tutorial. This is an optional ! You can use your webserver without it as well, but it just makes my life easier giving my GUI access to create,destroy,edit tables, databases etc.
  2. Extract all the files inside the phpMyAdmin-3.1.4-all-languages.zip to a C:\phpmyadmin. Now navigate inside C:\phpmyadmin you`ll see another folder named phpMyAdmin-3.1.4-all-languages (even if the name is something else), rename this folder to pma. Cut this renamed pma folder and paste it inside C:\server\www\myserver.dev\public_html
  3. PhpMyADMIN

    Edit config.inc.php

  4. Navigate inside the pma folder. Find the file config.sample.inc.php, rename it to config.inc.php. Now Open it and then replace all the code with the following
    01.< ?php
    04.$cfg['blowfish_secret'] = 'abc'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
    06.* Servers configuration
    08.$i = 0;
    11.* First server
    14./* Authentication type */
    15.$cfg['Servers'][$i]['auth_type'] = 'cookie';
    16./* Server parameters */
    17.$cfg['Servers'][$i]['host'] = 'localhost';
    18.$cfg['Servers'][$i]['connect_type'] = 'tcp';
    19.$cfg['Servers'][$i]['compress'] = false;
    20./* Select mysqli if your server has it */
    21.$cfg['Servers'][$i]['extension'] = 'mysql';
    22.$cfg['Servers'][$i]['user'] = 'root';
    23.$cfg['Servers'][$i]['password'] = 'root';
    25.$cfg['UploadDir'] = '';
    26.$cfg['SaveDir'] = '';

    Save the file.

  5. Now If you have followed everything properly, when you point your web browser to http://www.myserver.dev/pma/index.php you will see a login screen or the following screen.
    If you get the login screen, the username and password is root.

    PhpMyAdmin at its best

  6. If you are able to view this, then You have completed this tutorial successfully !!!!! *sigh*



Posted 2009年05月3日 by gw8310 in 未分类


Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )


Connecting to %s

%d 博主赞过: