You are on page 1of 16

Tutorial : Installing Apache 2.2.11, PHP 5.3, MySQL 5.1.36 & PhpMyAdmin 3.

2 in Windows 7/Vista/XP

This tutorial is a textual version complementing Screencast #1 : Installing Apache 2.2, PHP 5.3, MySQL 5.1 & PHPMyAdmin 3.2 for Windows 7/Vista The Tutorial is the modified version found at Vision Master Designs.

Index :
Step 1 : Install Apache Step 2 : Install & Configure PHP 5.3 Step 3 : Configure Apache 2.2.11 Step 4 : Testing our Apache + PHP Step 5 : Installing and Configuring MySQL5 Step 6 : Installing and Configuring PhpMyAdmin 3 Optional Step 7 : Making Windows recognize myserver.dev Optional

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. Download Apache 2.2.11 (with no mod ssl) (1325) 2. PHP 5.3 Download PHP 5.3.0 (VC6 Thread safe) (1558) 3. MySQL 5.1.36 Goto Download page 4. PHPMyAdmin 3.2.0.1 PHPMyAdmin Download Page | Direct Download PHPMyAdmin 3.2.0.1 (614)

The above downloads are compatible with Windows 7/Vista/Vista SP1 (32 bit OS). Before starting this tutorial. Please Turn off UAC (User Access Control) in Vista. Trust me you will get fed up on how many times it`ll popup while installing this environment.

Step 1 : Install Apache


1. First create a New Folder in C:\ and name it as server. 2. Start the installation, and follow the onscreen instructions as shown in the screencast. The settings for Server Information are given below.

Apache 2.2.11 Settings


3. Choose Custom Installation and specify the install path as C:\server\apache\ 4. Once Installation is complete, verify the installation by clicking on the Apache Icon in the taskbar, as shown in the screencast. You can also verify your installation of Apache by opening http://localhost/ in your browser. 5. Congratulations for a successful installation of Apache. We still have to configure Apache, we will do it in the coming steps.

STEP 2 : Install & Configure PHP 5.3


1. Extract PHP package

Now to install PHP5. Open the zip file & Extract all your files to C:\server\php. Navigate to C:\server\php
2. Rename php.ini- file

Search for the file, php.ini-development and rename it to php.ini


EDIT php.ini

Open up php.ini using any text-editor. (Notepad, Wordpad, Preferrably Dreamweaver). There are 2 edits in this file.

3. Edit 1

Find extension_dir = "./" and replace it with (Please note the slashes)
extension_dir = "C:/server/php/ext"

Edit 2

Now in the following edit, you just have to uncomment (by removing the ; semicolon) from the extension to activate it. So here are the extensions to be uncommented. Search for each one them and remove the semicolon ;
;extension=php_gd2.dll ;extension=php_mbstring.dll ;extension=php_mysql.dll ;extension=php_mysqli.dll

The First extension enables the Image GD library of PHP. The Second enables mbstring. The Third and forth enables us to use MySQL database.

Save the php.ini file.


4. Adding PHP Environmental Variables in the System path

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, C:\server\php;

PHP Environmental Variables


5. 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. 6. Finally, Step 2 is over !. Now we have PHP configured. Lets move on to configuring Apache.

STEP 3 : Configure Apache 2.2.11


1. Now navigate to C:\server\Apache\conf 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. 2. 3. 4. Try different text editor Stop Apache server from the taskbar and then try to edit You should have administrative previliges. Try disabling UAC 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

Okay, brace yourself, we got 5 Edits in this file. No big deal, pretty simple search and replace text.
Edit 1

Search for
#LoadModule rewrite_module modules/mod_rewrite.so

Replace with
LoadModule rewrite_module modules/mod_rewrite.so

Edit 2

Add the following below the previous edit


#PHP5 LoadModule php5_module "C:/server/php/php5apache2_2.dll" PHPIniDir "C:/server/php"

Edit 3

Search
AddType application/x-gzip .gz .tgz

Add the following below the searched line


AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps

Edit 4

Search for
DirectoryIndex index.html

Replace with
DirectoryIndex index.html index.php

Edit 5

Search for
#Include conf/extra/httpd-vhosts.conf

Replace with
Include conf/extra/httpd-vhosts.conf

2. Now navigate to C:\server\Apache\conf\extra Edit httpd-vhosts.conf 3. Replace all the text inside with view sourceprint?

<virtualhost *:80> DocumentRoot "C:/Server/www/myserver.dev/public_html" ServerName myserver.dev ServerAlias www.myserver.dev <directory "C:/Server/www/myserver.dev/public_html"> AllowOverride All Options Indexes FollowSymLinks Order allow,deny Allow from all </directory> </virtualhost>

4. Restart the Apache Webserver

If you have followed perfectly you`ll see that Apache has restarted perfectly.

Step 4 : Testing our Apache + PHP


1. Create Directories to store your web files 1. Firstly lets make the required Directories. Create a New Folder inside C:\server. 2. Inside the C:\server folder, create folder called www 3. inside C:\server\www\ create myserver.dev 4. and then finally create public_html folder inside your
C:\server\www\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.
2. Create index.php

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.

view sourceprint?
<?php //index.php phpinfo(); ?>

Please note the file name, it is index.php. Many a times, Notepad saves it as index.php.txt, while saving, don`t forget to mention the type as All Files, this way Notepad will save it as index.php.

STEP 5 : Installing and Configuring MySQL5


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

2. Click Next after reviewing where you are installing

3. Skip the Sign-up.

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

Detailed Configuration

Developer Machine Multifunctional Database

InnoDB

DSS

Enable TCP/IP Working and PORT no

Standard Char Set

MySQL As Windows Service

User Name and Password = root

Execute
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. Test MySQL along with Apache+PHP

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. After it has restarted (green play icon will be displayed), point your favourite web browser to http://localhost.

PHP 5.3.0....nice 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.

mysql and mysqli are extensions for MySQL


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

STEP 6 : Installing and Configuring PhpMyAdmin 3


1. Extract the PhpMyAdmin 3 package

This is an optional ! You can use your webserver without it as well. Extract all the files inside the phpMyAdmin-3.2.0.1-all-languages.zip to a C:\phpmyadmin. Now navigate inside C:\phpmyadmin you`ll see another folder named phpMyAdmin-3.2.0.1-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

2. 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 | password is root | root.

STEP 7 : Making Windows recognize myserver.dev Optional


Editing hosts file

Navigate to C:\Windows\System32\drivers\etc Open up hosts in notepad/wordpad/dreamweaver any text editor and add the following

view sourceprint?
1.127.0.0.1 1.127.0.0.1 myserver.dev www.myserver.dev

Conclusion
Thank you for reading this tutorial, hope you guys enjoyed There is a screencast based on this tutorial, so do check it out Screencast #1 : Installing Apache 2.2, PHP 5.3, MySQL 5.1 & PHPMyAdmin 3.2 for Windows 7/Vista

You might also like