Tutorial : Installing Apache 2.2.11, PHP 5.3, MySQL 5.1.36 & PhpMyAdmin 3.2 in Windows 7/Vista/XP
This tutorial will teach you how to install and configure Apache 2.2.11 + PHP 5.3 + MySQL 5.1.36 and PHPMyAdmin 3.2.0.1 for Windows Vista & Windows 7 in a step by step manner. There is also a screencast available.
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 :
- 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) (2251) - PHP 5.3 – Download PHP 5.3.0 (VC6 Thread safe) (2511)
- MySQL 5.1.36 – Goto Download page
- PHPMyAdmin 3.2.0.1
PHPMyAdmin Download Page | Direct Download PHPMyAdmin 3.2.0.1 (909)
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
- First create a
New Folder
inC:/
and name it asserver
. - Start the installation, and follow the onscreen instructions as shown in the screencast.
The settings for Server Information are given below.
- Choose Custom Installation and specify the install path as
C:/server/apache/
- 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.
- 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
-
Extract PHP package
Now to install PHP5. Open the zip file & Extract all your files to
C:/server/php
. Navigate toC:/server/php
-
Rename php.ini- file
Search for the file,
php.ini-development
and rename it tophp.ini
EDIT php.ini
Open up
php.ini
using any text-editor. (Notepad, Wordpad, Preferrably Dreamweaver). There are 2 edits in this file -
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.
-
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 theEnvironmental Variables
button, then scroll down in system variables to findPATH
, Edit it Add the following Code to it, as shown below in the image,C:/server/php;
- 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.
- Finally, Step 2 is over !. Now we have PHP configured. Lets move on to configuring Apache.
STEP 3 : Configure Apache 2.2.11
- 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
- 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 lineAddType 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 - Now navigate to
C:/server/Apache/conf/extra
Edit httpd-vhosts.conf
- Replace all the text inside with
01.
<virtualhost *:80>
02.
DocumentRoot
"C:/Server/www/myserver.dev/public_html"
03.
ServerName myserver.dev
04.
ServerAlias www.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
10.
</directory>
11.
</virtualhost>
-
Restart the Apache Webserver
If you have followed perfectly you`ll see that Apache has restarted perfectly.
Step 4 : Testing our Apache + PHP
-
Create Directories to store your web files
- Firstly lets make the required Directories. Create a
New Folder
insideC:/server
. - Inside the
C:/server
folder, create folder calledwww
- inside
C:/server/www/
createmyserver.dev
- and then finally create
public_html
folder inside yourC:/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. - Firstly lets make the required Directories. Create a
-
Create index.php
Open up notepad, type in the following code and save the file as
index.php
insideC/:server/www/myserver.dev/public_html/
as shown in the above picture.1.
<?php
2.
//index.php
3.
phpinfo();
4.
?>
Please note the file name, it is
index.php
. Many a times, Notepad saves it asindex.php.txt
, while saving, don`t forget to mention the type as All Files, this way Notepad will save it asindex.php
.
STEP 5 : Installing and Configuring MySQL5
- Lets start by unpacking the zip & start the installation. Select Typical, click Next
- Click Next after reviewing where you are installing
- Skip the Sign-up.
- Install SQL, Now time to configure SQL. Its pretty simple, if you follow the onscreen instructions.
- Now just follow the following images.
- 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.* -
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 .
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.
- 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
-
Extract the PhpMyAdmin 3 package
This is an optional ! You can use your webserver without it as well.
Extract all the files inside thephpMyAdmin-3.2.0.1-all-languages.zip
to aC:/phpmyadmin
. Now navigate insideC:/phpmyadmin
you`ll see another folder namedphpMyAdmin-3.2.0.1-all-languages
(even if the name is something else), rename this folder topma
. Cut this renamedpma
folder and paste it insideC:/server/www/myserver.dev/public_html
- 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 isroot | 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
1.
127.0.0.1 myserver.dev
2.
127.0.0.1 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
If you are having any trouble, feel free to post a comment.