April 19th, 2009
Tutorial : Installing Apache 2.2.11, PHP 5.3, MySQL 5.1.34 & PhpMyAdmin 3.1.4 in Windows Vista/XP
The most recent version of this tutorial has been completely re-written at WebDev Codex.
Learn how to Install PHP 5.3,
To view the latest version, Goto Screencast #1 : Installing Apache 2.2, PHP 5.3, MySQL 5.1 & PHPMyAdmin 3.2 for Windows 7/Vista
If you want to see the screencast of this tutorial, then goto
Screencast #1 : Installing Apache 2.2, PHP 5.3, MySQL 5.1 & PHPMyAdmin 3.2 for Windows 7/Vista
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 :
- Page 1 : Introduction
- Page 2 : Create Directories & Install Apache
- Page 3 : Install PHP5 & Configure php.ini
- Page 4 : Configure Apache 2.2
- Page 5 : Installing & Configuring MySQL5
- Page 6 : Installing & Configuring PhpMyAdmin
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.
- 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 - 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 - 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 - 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).















December 4, 2008 at 4:31 pm
@Jeanette
You have to a lil more specific.
Have you tried pointing to http://www.myserver.dev ?
The best bet now would be for you to uninstall everything and try installing freshly once again.
Do also check the environment variables in Control Panel -> System -> Advanced -> environment variables
December 4, 2008 at 8:13 am
Hi Michael,
I am so grateful I found your tutorial because I was able to know the connection and importance of Apache, PHP, MySQL and PHPMyAdmin and how they are intertwined. Thanks for the very good explanation. However, I installed the Apache and did everything as you have instructed but It did not work when I typed the http://localhost/ in web browser. I do not know what went wrong. I appreciate your response. Many thanks.
Jeanette
December 3, 2008 at 10:58 am
Hi, thank you so much for the tute..
but one slight problem.. even though I restarted my computer after changing environmental variables,
my mysql and mysql_li isnt showing up in http://www.myserver.dev
December 3, 2008 at 2:10 am
@Pierre Sutherland
i can edit the file just fine. i just don’t understand why there would be a syntax error preventing Apache from opening.
the error message says that this is where the “directive requires additional arguments”:
Directory
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
/Directory
December 3, 2008 at 1:42 am
Excellent tut thanks! Also had the problem with the conf file editing: managed to get around it by copying the conf file to another directory, renaming it to txt (use the command line RENAME if need be), make the edit, RENAME back to conf and finally copying back into the original directory as a replace.
December 3, 2008 at 1:12 am
oops. this is the error:
Syntax error on line 190 of D:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:
[] directive requires additional arguments
and here’s the directory code:
[
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
]
December 3, 2008 at 1:07 am
michael, great site!
after configuring the apache files and trying to restart apache, i get this error:
“Syntax error on line 190 of D:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:
directive requires additional arguments”
i only changed the code as indicated in your tutorial, so i’m not sure why this would come up. this is what the Directory code looks like:
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
any help would be greatly appreciated.
thanks.
December 2, 2008 at 9:39 pm
Update :
Till WordPress fixes a bug regarding the pagination problem.
I have put the entire tutorial in one page, for all the users having problem with the links.
Regards
December 1, 2008 at 9:01 pm
@jsp254
Thanks for the information, actually all the links are working, but I dunno why its happening. You can keep trying to open the pages again and again you`ll manage to get to the page.
I`ll just check into it. It started after I upgraded to the latest wordpress verion 2.6.5
December 1, 2008 at 8:46 pm
cant get past page 1. the links to pages 2-6 all revert back to page 1. i think your page is broke
November 30, 2008 at 10:51 am
Installed Apache, PHP, MySQL on Vista. Went nuts trying to get phpMyAdmin working……then I found your tutorial…..Thanks for the help!
November 23, 2008 at 12:07 pm
@Michael
After installing it for the third time and getting the same gibberish I went back and check my index.php file. Vista said that it was a PHP file and when I opened it in WordPad it looked perfect. But then I opened it in notepad and there was all the gibberish. Word pad saved it as an RTF file. ARRRGG. That’s one thing that I really dislike about vista. It doesn’t show extensions. So I erased the gibberish resaved my file as a .php file and everything works perfectly.
THANK YOU!!!! I’m so excited to be able to test my PHP code on my own machine. I could never have done it with out your excellent tutorial. It was very detailed and easy for a newbie like me to follow. Looks like I’m getting dreamweaver so that I don’t end up with anymore RTF files.
November 22, 2008 at 10:39 am
@Jessica
If you are able to view the php code, you are right, php is not installed properly.
I would suggest you uninstall and reinstall the entire set-up again.
BTW you can display php codes
[sourcecode]
[code]
//your php code here
< ?php
echo "w00t";
?>
[/code]
[/sourcecode]
November 22, 2008 at 8:08 am
@Jessica
Shoot my last post did not show the php code. It’s the code that was in index.php. It was in front of the two /par in a row.
November 22, 2008 at 8:06 am
@Michael
I did a view page source for http://www.myserver.dev and got
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20\par
\par
\par
}
?
Since the PHP code is showing in the page source does that mean that I don’t have the php installed right?
November 22, 2008 at 4:25 am
Good Instructions. Just installed the whole system (pages 1-6) on Windows XP SP3 and it works well! Had to re-edit the “php.ini” file and change the comment to command for “extension = php_mcrypt.ddl” AND, a slight oversight on my part, re-do the MySQL config. Wizard to change the port # from the default to 3306. After the two changes – Voila – it all worked. Thanks All -
November 21, 2008 at 10:59 pm
@Michael
Ok the server name was commented out. I uncommented it and am no longer getting the “httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.100 for ServerName.” error.
However when I go to http://www.myserver.dev/ I’m still getting
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20\par \par \par } ?
instead of the phpinfo.
November 21, 2008 at 10:47 pm
@Jessica
I am assuming you haven`t set the ServerName properly.
Check your httpd.conf & httpd-vhosts.conf files for the values of ServerName and ServerRoot and check the Apache documentation to see what they should be. Just double check those values with the ones that should ideally be (as given in the tutorial)
November 21, 2008 at 10:11 pm
@Michael
This
“{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20\par \par \par } ?”
comes up when I go to http://www.myserver.dev/ .
Because of that error I started searching for what might be causing it. I found this statement
“httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.100 for ServerName.”
in C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.conf
I wasn’t trying to change the server name. While following steps 1 through 3 everything seemed to be going great. Everything you said to test worked. I didn’t have any problems until after step 4 when I got that gibberish instead of the phpinfo();
November 21, 2008 at 6:36 pm
@Jessica
Hey Jessica
Why did you have to change the server name ?
BTW the error you are getting, where does the error popup ? Does the error come up when you execute the php file ? or after installing a message box pops up with this error ?
November 21, 2008 at 6:07 pm
hey,
I have an issue that I havn’t been able to find in the comments. I hope I’m not repeating a question. I followed all of the steps and did the checks. My php is installed and appears to be right according to the Apache line at the bottom. After installing Mysql I get
“{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20\par \par \par } ?”
My index.php doesn’t have the .txt at the end and it’s in the right folder. I have uninstalled and deleted everything and reinstalled and still got the same error. I’ve disable my virus scanner and my firewall. I’m at a lose and can’t figure this out. The apache error log says “httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.1.100 for ServerName.” Could that be the problem? How do I fix that?
BTW THANKS! for posting these instructions!! It’ll be great when I get it working.
November 21, 2008 at 8:36 am
@Elaine
Hey Elaine,
thats odd, have you tried http://myserver.dev ? Does it work ?
Most probably you haven`t configured httpd.conf file properly.
Please recheck. Lemme know
Regards
November 21, 2008 at 1:05 am
This is great … I am new to php, and was searching about how to install and configure php in my vista business edition…. after investing my 1 hr with this tutorial now my notebook is completely configured with apache, sql and php ………. I would really like to appreciate this.
November 21, 2008 at 12:12 am
I seem to be having an issue with the installation of the apache server.. when I try http://localhost/ I get a page load error.. help! please and thank you I’m a total newbie
November 19, 2008 at 1:19 am
@Michael
After more reading, I decided to reconfigure MySQL. I went into the MySQL Server Instance Configuration Wizard and selected “Reconfigure Instance”. Then, I followed all of your instructions again from this tutorial, making sure that the username and password were both set to ‘root’. Then I used the code you just posted here for the ‘config.inc.php’ file. Everything works like a dream!
Again, thanks for this excellent tutorial and informative comments/responses. Greatly appreciated!
November 18, 2008 at 10:43 pm
@Frost
If you are having a problem with the phpMyAdmin config-file code, try this
[code]
< ?php
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
/* User for advanced features */
$cfg['Servers'][$i]['user'] = 'root'; //mysql username
$cfg['Servers'][$i]['password'] = 'root'; //mysql password
?>
[/code]
Thanks for your encouraging word.
November 18, 2008 at 9:50 pm
Excellent tutorial!
NOTE: I’m running Vista SP1 with UAC turned off. I’m also connected to the internet via a proxy server, so I had to do some light troubleshooting in my browsers to set http://www.myserver.dev as an exception to ignore the proxy. The rest of this tutorial was very easy to follow!
My only snag is the last step: setting the config.inc.php file. Copying/pasting your code gets me to the phpMyAdmin login prompt, but the username ‘root’ and password ‘root’ returns the following error:
#1045 – Access denied for user ‘root’@'localhost’ (using password: YES)
I have tried using other versions of config.inc.php, and I get similar results. Googling for other solutions, but thought I’d ask here. Is there something I’m missing?
Thanks again, great tutorial!
- Frost
November 18, 2008 at 8:41 pm
@Kevin
Thanks For your kind words.
November 18, 2008 at 7:45 pm
Michael. thank you so much. Idiot proof – it worked just great for me. So nice to find your lovely clear instructions having almost given up on the idea of getting this lot working together after having tried to follow the instructions at other sites!
Maximum respect is due!
November 11, 2008 at 11:44 pm
I just wanna add that my http://localhost/ points to C:\Program Files\Apache Software Foundation\Apache2.2\htdocs .
If I type http://localhost/ says “It Works”.
Is it supposed to point to C:\Server\www\myserver.dev\public_html
November 11, 2008 at 11:34 pm
Hello Michael,
when i point my browser to http://localhost/index.php it just shows the php code
I have done everything according to the tutorial.
November 10, 2008 at 12:54 pm
I too am having the problem as reported by Akash in regards to the “www.myserver.dev”. When I try I get the DNS Error-Service cannot be found. I checked my local host, and I do get “Index of /
index.php.txt ”
Now I have to admit I am slightly crosseyed, and overwhelmed. But I checked the files you referred Akash too, and made the changes, but I am having the same result. Any Suggestions on where to look for whatever error it is that I made?
This is all new to me, last I knew c++ and so on were the rage, lol, and I have been asked to modify a site that is all in .php! :O Anyways, TY in advance for your help
November 10, 2008 at 4:19 am
Collin I had the same issue as you.
I had version 2.11.4 working. when tried to upgrade to version 2.11.9.3 it stoped working with the error you mentioned.
My solution was to go back and it worked fine again.
Try to downgrade or even better go to version 3.
Please delete previous message. I had a typo.
November 7, 2008 at 8:16 pm
hey Ksur,
There shouldn`t be any problem with setting variables. Please verify the path. If you temme what error you are getting, I can diagonize the problem better.
Regards
November 7, 2008 at 8:12 pm
hey CS Ghosh,
first I need to see the code before commenting anything.
If the normal script which was given in the tutorial worked, then there is no any problem.
Regards
November 7, 2008 at 3:55 pm
Help Me ,I’can’t set Variable value: C:\server\php; %System32..(. What is the path in this here.).?
November 6, 2008 at 5:46 pm
A very good evening. I’m very new to PHP. I’ve successfully installed Apache+PHP+MySQL according to your instruction. Now I want to write a simple PHP program in Notepad text editor as follows.
PHP By Example :: Chapter 1 :: Example 1
PHP By Example :: Chapter 1 :: Example 1
After that I’ve saved this code in the location C:\Server\www\myserver.dev\public_html with the name ch01ex01.php.
Now when I’m trying to open the page using a browser by typing the following address:
http://localhost/ch01ex01.php or http://myserver.dev/ch01ex01.php
The browser reports : “HTTP 500 Internal Server Error”.
Can u please help me out and tell me how can I run the PHP codes.
November 5, 2008 at 8:36 pm
Thanks for installation guide this helped me a lot.
But while configuring MySQL5.1, it ask for default root password to reset the password in configurtaion wizard, which is a mandatroy step.
I tried “root” as default password and gave the new password as well and click “Next” and afterwards click to “Execute”,
the wizard faild to “start the services”. kindly suggest
November 3, 2008 at 12:43 am
sorry sir, it was http://www.myserver.dev not .com
November 3, 2008 at 12:37 am
hello sir
thanks for ur reply..
sir, i m getting the phpinfo page when pointing the http://localhost/
but its not coming when i m trying http://www.myserver.com and i am also connected to the internet.Sir, ther eis no etc folder in windows/driver/etc
i added the hosts file, according to ur tutorial, in windows/system32/drivers/etc
and i copy and paste the code from ur site to hosts file. and it still not working but localhost is showing the phpinfo page
November 2, 2008 at 11:40 pm
Hey Akash,
Firstly, try pointing your web browser to http://localhost/
if you are able to view something, then apache installation is fine.
Secondly, see to it you are connected some way or the other while trying out http://myserver.dev (i.e either LAN or INTERNET)
Please double check whether you have added myserver.dev to your hosts file inside windows/drivers/etc directory
PhpMyADMIN is optional. It is used to manage MySQL databases. To know more about it,
http://www.visionmasterdesigns.com/2008/07/tutorial-using-phpmyadmin-to-manage-mysql/
official site – http://www.phpmyadmin.net/
Regards
November 2, 2008 at 11:28 pm
hi there…
i did the same as it is in this tutorial but after 5th step (after installing mysql) when i typed
“http://www.myserver.dev” i did anot get the page as shown in the image.
instead of that page “The requested URL could not be retrieved” page came out…
my apache server is also showing the green signal. I dont know what is wrong, because i followed each and every step and every result came out as ur tutorial says..but the above one didnt come.
please help me. what should i do now?
And may u tell me is it necessary to install phpmyadmin. Because i m stoped at 5th step. so please tell me what is phpadmin and why it is necessary? And also help me to solve the problem why i am getting url not found page.
waiting for ur reply
thanks for ur help
November 2, 2008 at 6:00 am
Wow… as it turns out, I had my directory settings wrong in “extension_dir = “; but I fixed that and both MySQL and PMA are working seamlessly. If I ever have to install these again, I might just literally have a cow :p
Anyhow, thanks for suggesting I go back over the code; I think I was just so frustrated that even though it seems like common sense to do so, I just wasn’t thinking of it.
November 2, 2008 at 1:38 am
Hey Jean,
firstly relax,
.
Normally it tends to happen that phpinfo() doesn`t show mysql/mysqli in the first go. It had happened to me too
But the thing is after you enable the extensions, the best thing to do is reboot you pc. I got it working that way.
I am sure you must have uncommented mysql & mysqli in php.ini file (Do check again) . Try uncommenting some other extensions along with it, like the gd library, mcrypt etc.
Once you have done that, reboot the computer. cuz we have defined the path of php in the system variables and when we have made changes to php.ini, the system needs to realize it & the only way to do it is by rebooting the computer.
Lemme know the results
Regards.
November 2, 2008 at 1:28 am
Ok… I put all the info into .txt files and uploaded them to my online server (note: this is not the server I’m having trouble with- vanilla-chai is hosted by somebody else; I’m having trouble setting up these files on my PC [localhost] so I can work on my site offline before uploading it and making it live.)
Anyhow, here’s the first file to test my MySQL connection:
vanilla – chai. nu /txt/mysql-test.php.txt
And here’s the code I punched into a homemade config.inc.php file:
vanilla – chai. nu /txt/config.inc.php.txt
Take note of all the spaces, I did that in case the form didn’t want to accept URL’s.
November 2, 2008 at 1:13 am
Ugh…! I’m sorry for all the reposts- my brain is apparently gone this weekend. If this doesn’t work, I give up.
*********************
I apologize for not having my code up there correctly- I was unsure if your posts allowed for html/bbcode so I didn’t really think much about them them.
Anyhow, I’ve actually got an entire new problem.. I had to reformat/re-install my OS yesterday afternoon due to some nasty malware which had been building up. So I’ve gone ahead and re-installed Apache, PHP & MySQL (haven’t gotten to phpMyAdmin yet)… the installastion of both PHP and Apache went smooth, absolutely no errors. Then, I installed MySQL.
I thought the installation had gone great, as I didn’t receive any errors during the process.. so I ran a test script to see if I could connect to MySQL:
[code]<!-- --> [/code]
When I pulled up the page, nothing shows up.. I just get an empty white page- it doesn’t tell me if it did connect, or if it didn’t. So I went to my info.php page, and I don’t have mysql/mysqli in there anywhere. I also tried doing a search for config.inc.php and that wasn’t on my system, either.. so I just created a new file and entered in the following:
[code]<!-- -->[/code]
I restarted Apache (in fact, I’d been doing this every time I made changes, still to no avail) and still nothing.. I still have the same blank page, and nothing is showing up in my info.php. Any ideas what’s going on?
November 2, 2008 at 1:09 am
I apologize for not having my code up there correctly- I was unsure if your posts allowed for html/bbcode so I didn’t really think much about them them.
Anyhow, I’ve actually got an entire new problem.. I had to reformat/re-install my OS yesterday afternoon due to some nasty malware which had been building up. So I’ve gone ahead and re-installed Apache, PHP & MySQL (haven’t gotten to phpMyAdmin yet)… the installastion of both PHP and Apache went smooth, absolutely no errors. Then, I installed MySQL.
I thought the installation had gone great, as I didn’t receive any errors during the process.. so I ran a test script to see if I could connect to MySQL:
[code][/code]
When I pulled up the page, nothing shows up.. I just get an empty white page- it doesn’t tell me if it did connect, or if it didn’t. So I went to my info.php page, and I don’t have mysql/mysqli in there anywhere. I also tried doing a search for config.inc.php and that wasn’t on my system, either.. so I just created a new file and entered in the following:
[code][/code]
I restarted Apache (in fact, I’d been doing this every time I made changes, still to no avail) and still nothing.. I still have the same blank page, and nothing is showing up in my info.php. Any ideas what’s going on?
November 1, 2008 at 11:36 pm
Hello Pedro G,
Normally index.html, index.php will load default when you point to http://www.myserver.dev
So either you can rename sub_mobile.html to index.html, so that it can load by default
else
you would have to edit httpd.conf file which is not advised
Regards
November 1, 2008 at 6:14 am
Michael,
Forget comment #254 I figure it out.
But, how do I get the first page instead what you see below:
Another words how do I get Sub_Mobile.htm to appear first so my website looks correctly.
This is what its display when I — http://www.myserver.dev/
Index of /
Sub_Mobile.htm
Sub_Mobile_order.htm
Sub_Mobile_order.php
Sub_Mobile_soup.htm
Sub_Mobile_special.htm
November 1, 2008 at 1:10 am
Michael,
I go it to work.
The problem is you have written C:/Server/www/myserver.dev/public_html
but
my setup is C:/Server/php/www/myserver.dev/public_html
my mistake.
Last question??????
This is new to me working with PHP and HTML
If I were to create a project where I am using more than one php file stored in \public_html\
how does apache know which of the two php
is going to open?
Question: Is the apache being used as a simulator?
Last,
Thank you very very much.
You are the best!!!