Install PHP under Apache and Vista
June 6, 2007I initially tried the msi installer for PHP 5. Unfortunately, it installs only PHP under CGI, which although it has some performance and security issues, might be ok for a quick and dirty development environment.
But the installer is badly broken. You’ll get an error something like
PHP Fatal error: require_once()[function.require]: Failed opening required 'SAM/php_sam.php' (include_path='.;C:php5pear') in sam_factory on line 1
After fighting this for a couple of hours, I ended up installing manually anyway. I used this procedure to get PHP 5 running under Vista:
- Install the Apache webserver.
- Get the current version of PHP 5 from http://www.php.net/downloads.php#v5. (It’s 5.2.3 at this time). Get both the zip file and the PECL zip file (which includes extensions).
- Uninstall any previous installations of PHP 5 (Start > Control Panel > Programs and Features). You may have to reboot your machine.
- Disconnect from the Internet. Turn off your firewall. Turn off your virus checker.
- Turn off User Account Control (UAC).
- Get an administrator prompt by going to All Programs > Accessories. Right-Click “Command Prompt” and choose “Run as Administrator”
- Use the command prompt to manually remove directories containing previous PHP installations (like C:\Program Files\PHP…)
- Go to the directory where you’ve downloaded the PHP5 and PECL zipfiles. Extract the PHP zipfile. Rename the extracted php directory (which has a name something like php-5.2.3-Win32) to c:\php. Extract the PECL zipfile into c:\php\ext.
- In the command prompt, type:
cd c:\php mkdir upload mkdir session copy php.ini-recommended php.ini
- Open php.ini in Notepad:
- There are many variables… the following are important. Notice that starting a line with a semicolon in the ini file comments it out.
upload_tmp_dir="C:\php\upload" session.save_path="C:\php\session" cgi.force_redirect=0 extension_dir ="C:\php\ext" display_errors = Off log_errors = On error_log = "C:\php\error_log"
- You might want to look at upload_max_filesize. I’ve set mine to 16M. I also set post_max_size = 16M.
- Enable the extensions you need by deleting the semicolon at the beginning of the line. These will depend on your application… I’m going to be using MySQL (which I’ve already installed) and Moodle (which I’ll install later). My list looks like the following:
extension=php_bz2.dll extension=php_curl.dll extension=php_dba.dll extension=php_dbase.dll ;extension=php_exif.dll extension=php_fdf.dll extension=php_gd2.dll extension=php_gettext.dll ;extension=php_gmp.dll ;extension=php_ifx.dll ;extension=php_imap.dll ;extension=php_interbase.dll extension=php_ldap.dll extension=php_mbstring.dll extension=php_mcrypt.dll extension=php_mhash.dll extension=php_mime_magic.dll ;extension=php_ming.dll ;extension=php_msql.dll ;extension=php_mssql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll extension=php_openssl.dll ;extension=php_pdo.dll ;extension=php_pdo_firebird.dll ;extension=php_pdo_mssql.dll ;extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_oci8.dll ;extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll ;extension=php_pdo_sqlite.dll ;extension=php_pgsql.dll ;extension=php_pspell.dll extension=php_shmop.dll ;extension=php_snmp.dll extension=php_soap.dll extension=php_sockets.dll ;extension=php_sqlite.dll ;extension=php_sybase_ct.dll extension=php_tidy.dll extension=php_xmlrpc.dll extension=php_xsl.dll extension=php_zip.dll
- There are many variables… the following are important. Notice that starting a line with a semicolon in the ini file comments it out.
- Right-Click on Start > Computer. Choose “Properties”, then “Advanced”. Click on “Environment Variables”. Click on PATH, then Edit… and add “;C:\php;c:\php\ext” (without quotes) to the end of the variable.
- Open your Apache configuration file (All Programs > Apache HTTP Server 2.2.x > Configure Apache Server > Edit the Apache httpd.conf Configuration File). Add the following lines:
LoadModule php5_module "C:\php\php5apache2_2.dll" AddType application/x-httpd-php .php AcceptPathInfo on PHPIniDir "C:\php"
(UPDATE: When I installed PHP 5.2.13 using this procedure (July 2010) under Apache 2.2.15, I found that I had to delete that last line (the PHPIniDir directive) or Apache wouldn’t start.)
Look for the DirectoryIndex line. Add ” index.php” (no quotes) to the end of that line.
Save the file.
- Create a file named test.php in your Apache htdocs directory, containing this text: <?php phpinfo(); ?>
- Reboot your machine.
- Browse to http://localhost/test.php. You should see tabulated information about your working PHP installation.
Thanks, this was a lifesaver. I’d been trying to install for weeks and this works perfect.
by Sharron Penfold June 18, 2007 at 10:45 pmI tried to install MySQL which went pretty smooth. However, configuring it was a problem. I opened up port 3306 but it still gives me a port 3306 error. Can you help? Thank you
by Bert June 27, 2007 at 2:20 amHi-
I tried to install php and open to my explorer but i got error. I copied it here. Please help me. Thanks
Server Error in Application “Default Web Site”
——————————————————————————–
HTTP Error 404.0 – Not Found
Description: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Error Code: 0x80070002
Notification: MapRequestHandler
Module: IIS Web Core
Requested URL: http://localhost:80/test.php
Physical Path: C:\inetpub\wwwroot\test.php
Logon User: Anonymous
Logon Method: Anonymous
Handler: StaticFile
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
What you can try:
Create the content on the Web server.
Review the browser URL.
Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
More Information… This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
——————————————————————————–
by Dinah July 14, 2007 at 3:52 amServer Version Information: Internet Information Services 7.0.
This worked out great for me! Thank you.
Dinah,
Did you create the test.php file and put it in the directory “C:\inetpub\wwwroot\”?
It looks like apache is setup properly but the browser just isn’t finding the test.php file in your wwwroot.
by Billy July 14, 2007 at 4:38 amI got php and apache to work, but still get mysql working with php.
I installed mysql and am able to access it via the prompt.
PhP and Apache are installed and working.
I removed the semi-colon from the line
extension=php_mysql.dll
and did everything else this post describes but still get the following error when trying to view any of my php scripts that use mysql:
“Fatal error: Call to undefined function mysql_connect() in X”
where X equals the php file.
I’ve uninstalled everything and re-installed it all from an Administrative Command Prompt and still get stuck with the same error.
I’m running Vista Home on a core 2 duo, UAC is disabled.
Any ideas?
Thanks in advance!
by Billy July 15, 2007 at 8:19 pmsorry, I meant mysql WON’T work with php. php doesn’t seem to be loading the extensions even though the extension_dir line is uncommented and pointing to the right ext dir with the pecl extension files.
by Billy July 15, 2007 at 8:21 pmI got the test.php script to work. I have an index.php in my folder with the test.php script. When I try to open up index.php I get a dialog box asking me how I want to open the file. Test.php works fine. Can anyone help me on this?
by Allison July 17, 2007 at 5:36 pmAnother note of appreciation.
I wasted a good 2 days of my life mucking around, trying to get PHP running under Vista.
I read your post, followed your instructions and voila, success!
Now, on to MySQL.
Thanks again.
by Les` July 21, 2007 at 4:25 amAgain, very nice tutorial. I was able to get both apache and php up and running in no time at all!
cheers.
by Matthew Sweet July 28, 2007 at 4:51 amGrrr – Apache installed fine, but when I added PHP, the service (apache) won’t start.
I hate stupid Microsoft.
by Chad July 31, 2007 at 1:56 amAfter using the php5 msi apache can’t find the conf file. Must be permissions, but I haven’t figured it out yet.
by skylimey August 1, 2007 at 4:53 amGreat tutorial. Managed to get both apache and php running.
by sean August 3, 2007 at 11:03 amFollowed your directions for installing both Apache and PHP under Vista. Apache’s worked great so far, no problems, but after following directions for PHP (step by step, word for word) I get a 404 error when searching for localhost/test.php. I know it’s probably something simple, but I still can’t find it after 2 days of searching. Can anyone offer ideas? thx
by Chris August 4, 2007 at 3:11 pmHi very helpfull tutorial indeed.
just a small advice if you still have a problem running apache after installing php try -not- to include following lines into apache config file:
AcceptPathInfo on
PHPIniDir “C:\php”
RGDS,
by Maxim Shubin August 5, 2007 at 6:53 amMax
Max thank you for the small advice this fixed my problem 🙂
by Chris T December 24, 2009 at 4:22 amMax
Commented those 2 lines out of the httpd file, but still no change. Still getting just a plain 404 error and I can see the file is physically where it is supposed to be (C:\apache\htdocs). Thanks for the idea.
From the error log:
[Sun Aug 05 09:01:15 2007] [error] [client 127.0.0.1] script ‘C:/apache/htdocs/test.php’ not found or unable to stat
by Chris August 5, 2007 at 3:06 pmHey Chris,
1. I hope you are trying to open it like this: http://localhost/test.php because C:/apache/htdocs/test.php’ will not work.
2. When you configure apache according to the above tutorial try to put this lines:
(LoadModule php5_module “C:\php\php5apache2_2.dll” and
AddType application/x-httpd-php .php)
in a proper position in configuration file(you will see some similar fields in it).
3. And don’t forget to restart apache every time you change something in configuration. In my case I had to restart the whole system, because (net stop/start apache did not work)
Hope it will help.
RGDS,
Max
P.S. In my case I’ve installed MySQL,PHP and apache on Vista Ultimate edition, so maybe there is a bug in other editions however I doubt this, just try to go thru everything step by step again.
by Max August 6, 2007 at 11:38 pmthank god for you. there’s no way i wanted to sit down and map config thru vista.
by dan neumann August 8, 2007 at 12:17 pmNice one, this tutorial and the one on Apache were great…gonna try MySQL now, fingers crossed this is gonna go jus as smooth.
Thanks for the article
by Carlton Dickson August 16, 2007 at 7:41 pmI worked through this paper to install MySQL…the only real thing that was different from a regular .exe file install was disabling UAC first and then running it…working fine now!
I did get one error just after mysql tries to connect to server but I hit the retry key and it was fine and I connected using my mysql gui “sqlyog” just fine
Click to access MySQL_Windows.pdf
by Carlton Dickson August 16, 2007 at 8:07 pmFortunately I didn’t need to go through the whole script to get php and apache working on Vista… but there is now a problem I can’t work out with MS SQL. All the following is working fine on Windows XP using PHP 4.4.4.
The php script content.php includes head.inc. In head .inc we obtain the title name for a page with a db query for example:
$title = $db->GetOne($q) or $db->ErrorMsg().$q;
with say:
$q = ‘Select pname from pal where pge = $page’;
Now I have checked the $db->Connect statement and it gets the server, database username, password etc…. perfectly and establishes a connection.
So I can’t see any connection issues but it simply stops.
any suggestions?
I’ve been working on this most of the day and it’s driving me nuts.
thanks
Rose
I’ve put many print statements to debug… however the print statement after the $db->GetOne statement does not print out, there is no error message, just no page displayed.
by Rose August 21, 2007 at 6:25 amAgain….WONDEFUL!!!
by Nate August 25, 2007 at 7:51 pmI installed the PHP 5.2.3 and PECL zip file exactly as described in this tutorial.
Modified the httpd.conf to add:
LoadModule php5_module “C:\php\php5apache2_2.dll”
AddType application/x-httpd-php .php
AcceptPathInfo on
PHPIniDir “C:\php”
However, C:\php\php5apache2_2.dll simply doesn’t exist in the C:\php directory. So where does this file com from? Is it built/compiled after the installation of all source code and extensions?
Any suggestions would be greatly appreciated, Thanks!
Ben
by Ben August 27, 2007 at 4:42 amI figured out the solution to my earlier question.
I need to download and install php-5.2-dev (zip) from http://snaps.php.net/. That package contains lots of DLLs including the missing php5apache2_2.dll.
Big thanks to the tutorial author. Without his installation steps I most likely am still trying to figure out how to install it under Vista.
by Ben August 27, 2007 at 5:41 amI followed guide and read all emails. I get the 404 error and can’t find test.php even though I’m using http://localhost/test.php and the file is physically where it belongs. If I load the file with File-Open, I get a message box saying “Do you want to save or open this file” and each time I click it, I get a window that appears and goes away so fast I can’t see what it would say, then I get the message box for ‘save or open’ again. This repeats.
thanks for any suggestions.
by Michael Fortenberry August 28, 2007 at 1:32 amMichael
Awesome Tutorial!
I followed every step and it worked on the first try.
If it helps anyone, this is what I installed on Vista basic:
php-5.2.3-Win32.zip
pecl-5.2.3-Win32.zip
Thanks again
by Pedro August 30, 2007 at 7:17 amYou are the MAN!!! It rocks…I successfully integrated PHP and Apache…on my way to MYSQL
by Raj August 31, 2007 at 3:22 amThis is a great tutorial. Thanks bro
But i still have a problem. For example… test file if i write without “php”, the file doesn’t appear. I need to write in order to get this file run successfully.
seem oppening php coding must be written in full !!!
by bob September 4, 2007 at 3:07 amAgain, an awesome walk-thru. Worked perfectly, thanks.
by triga September 8, 2007 at 2:23 amtry this:
LoadModule php5_module “C:\php\php5apache2.dll”
AddType application/x-httpd-php .php .php3 .php5 .phtml
AddType application/x-httpd-php-source .phps
PHPIniDir “C:\php\php.ini”
In the end of the file.
If you are using apache 2.0.X worked for me
by Anton September 17, 2007 at 8:06 pmi can open up the http://localhost/test.php and it gives me all the info…. but i can not find my wwwroot i tried searching my computer for it but still can not find it…. and i know you need one to do your php websites…. any idea what to do????
by Jessi October 14, 2007 at 11:57 pmhi
by yaz October 16, 2007 at 6:11 pmi have installed apahe, it runs fine
the trouble is that when install php…and configure the httpd.conf file
and add
LoadModulephp5_module “C:\php\php5apache2.dll”
PHPIniDir “C:\php”
it doesnt let me restart the apache…
i am running vista….apache works fine, without the above lines….
when i was setting up the server for php, i choose apache cgi(there were a few other opptions of apache to select from….
any suggestions?
I figured out the solution to my earlier question.
I need to download and install php-5.2-dev (zip) from http://snaps.php.net/. That package contains lots of DLLs including the missing php5apache2_2.dll.
Big thanks to the tutorial author. Without his installation steps I most likely am still trying to figure out how to install it under Vista.
by yaz October 16, 2007 at 7:10 pmben wrote above….
where are we supposed to extract that package???
i hope you come back to check on this board…for answers to your problems……jessi
the root directory, if you havent set any……. is htdocs
it supposed to be in your apache directory….
htdocs, is ure root directory, unless you set one….which in your case, i think you dint….
neway, is there anyone here who has a solution to my problem?????
by yaz October 19, 2007 at 2:46 pm[…] i came across this helpful post by senese: Installing PHP under Apache and Vista. I was able to get PHP working correctly, finally! Some steps may seem unnecessary (such as […]
by The Danosphere. » Blog Archive » Installing PHP under Apache and Vista October 20, 2007 at 12:22 amk does anyone have a soltution to my probelms, above???
by yaz October 20, 2007 at 1:40 pmI have installed everything and everything seems to work file. But every php script that I run that has HTML embedded does not show up. It just shows up as an empty site. The Title shows up and i get no other error. Can someone help me out? thank you all in advance
by Jonathan November 6, 2007 at 10:38 pmSince you’re running under Apache and not IIS, ought you not to leave cgi.force_redirect=0 as cgi.force_redirect=1? The web page here – http://uk3.php.net/releases/4_1_2_win32.php- is quite explicit that turning it off is needed and recommended only for IIS.
by Rob Harris November 11, 2007 at 3:42 pmGreat Tutorial!
I did have one problem, the service wouldn’t start after doing all the steps above. Changing the following line:
PHPIniDir “C:\PHP”
to
PHPIniDir “C:\PHP\”
fixed the problem.
by Joe Orr November 13, 2007 at 1:40 amLike many other comments above, I had spent days figuring out how to set this thing up. Your tutorial really safe my life!!!
Thank you very much!!!
by A reader November 18, 2007 at 4:43 amThank you so much for this really helpful tutorial. I followed these instructions and Apache/PHPE worked first time. Haven’t tried MySQL yet. Brilliant!
by Pat November 25, 2007 at 11:06 pmThanks a mill…yet to try mysql. but this is a life savior!
Apache 2.2.6 php 5.2.5..vista home prem.
by Irwan December 12, 2007 at 11:19 amThanks it works just great.
by Jose Colombi December 13, 2007 at 5:44 amYou legend! You’ve saved me much head scratching. Thanks.
by Steven Hines December 20, 2007 at 2:25 amThanks so much for putting this up. Please keep it up here too! I was so frustrated and lost with installing PHP and getting it to work with apache. I’m a novice programmer and I thought I would use this winter break from school to learn some PHP, and you have made that possible!
by Usama Ahmad December 20, 2007 at 7:58 amYou can try XAMPP or WITSuite (installation video: http://www.witsuite.com/products/installer/).
by Alex December 25, 2007 at 1:01 pmI have followed the tutorial above,and many other tutorials to try and get php5 working with apache on windows vista, however when i try to open localhost/test.php i get a message box asking if i want to open or save the file.If i click open it opens it upi n dreamweaver. Any ideas before i go mad and bin the laptop!!!
Cheers in advance
by Rob January 13, 2008 at 9:43 pmRob
i did everything stated and it turned out fine but when i try write my own code and save it in htdocs and try to access the script, via web, it doesn’t show up.
by jon January 14, 2008 at 8:00 amany help??
Ok the error above has been sorted, but now i start my Apache server, i see a few people have had the same problem, but cant seem to find a definative fix,have trie everything mentioned above,but still cant start it,if i change the LoadModule php5_module “C:\php\php5apache2_2.dll” to LoadModule php5_module “C:\php\php5apache2.dll” it startes but when i open localhost/test.php i just get the code displayed on the browser………any ideas for either problem????
by Rob January 15, 2008 at 10:18 pmsorry,meant to say it wont start in above post
by Rob January 15, 2008 at 10:19 pmAfter smashing my head off a wall for 5 hours and trying 3 or 4 sites with “solutions”, this one nailed it for me. My initial problems were related to IIS7 clashing with Apache. After I removed IIS7 and followed these, I was able to get it to work. I had the visible code problem too – meaning PHP interpolator is not being invoked.
Other points – make sure Apache service is stopped (if you have php as a sub directory of Apache) and you are deleting old php versions in that dir. There was a tip about not installing Apache in a dir with spaces as in “C:\Program Files”.
My php ini was “tweaked” already in C:\Windows – but I added the PHPIniDir “C:\Windows” to httpd-conf anyway. As %SYSTEMROOT% this should be unnecessary. I set the “Listen” parameter to 80 and Servername as localhost since i plan to do local development for testing and not actually deploy. MY ISP is not setup to allow me to “host” anyway. Maybe getting this local setup to work is a place to start for those wanting to deploy on a network or the internet, then mod the IP and port info later when you want to deploy.
Also I found I had to Modify the Security permissions on my Apache and php folders to add my admin account and give it full control (or modify) in order to save php.ini and httpd-conf. Vista doesn’t have groups it seems, so you can’t simply add the admin account to the Administrators group.
Thanks a million Mr. Senese for a working solution.
Cheers
by Scott February 8, 2008 at 2:57 amThanks for this quick and easy way to get up and running with PHP. I’m new to PHP and this was great!
by Sophia February 12, 2008 at 1:11 amI have some problems getting results from form submission when using just the file name in action attribute i.e action=”update.php”. file exist but shows errors like: HTTP 404 Not Found. Am using PHP5, Apache2 on Vista home premium. Any help ‘ll be appreciated!
by Johnson F February 12, 2008 at 1:03 pmThank you so much!
by Jamie February 16, 2008 at 4:37 pmThanks for the humungous help! However, after carefully following your instructions, I was still getting an internal server error (http #500) when trying to load the phpinfo test page.
Joe Orr’s suggestion to add a backslash to the end of the ini path fixed the problem! Change
PHPIniDir “C:\PHP”
to
PHPIniDir “C:\PHP\”
Thank you everyone. Why the heck isn’t there a “packaged” version to do all this boloney for us? What a waste of good time! Anyway I thought I would also pass on that I just ran into something called WAMP, which may be worth exploring, as it is supposed to install Apache/MySQL/PHP onto Windows all at once! Anyone have any experience with this?
by Smitty February 19, 2008 at 1:06 am[…] More incredible thanks to: https://senese.wordpress.com/2007/06/06/install-php-5-under-apache-22-and-windows-vista/#comment-262, […]
by How to install PHP on Apache running under Vista « Smitty’s Blog February 19, 2008 at 1:35 amThank you so much. I don’t want to broadcast my oops, however if it saves anyone an hour, it’s worth it. Double check that you didn’t extract your php directory in Program Files like I did… it needs to be at the root directory C:\php\. Also, I didn’t know where to put the additional config information, so the person who added “at the end of the config file” really helped me a lot. Thanks again for taking the time to post this.
by Jhanawa March 1, 2008 at 9:09 pmHey, thanks man. Very good indeed, never could’ve done it without this, thanks for all your hard work. Had previously installed on XP and was OK but was stumped on Vista.
BTW – I didn’t disconnect from internet, or turn off firewall or anti-virus and it sill worked a charm.
Thanks once again, where would be without someone posting their knowledge to help the rest of us out?
by Derek March 3, 2008 at 3:35 amCan i turn on UAC after i installed php?
by keffie91 March 3, 2008 at 4:26 pmThe apache server seems to be working for me because at localhost I could see the page indicating successful installation of apache. However, when tried again I get a listing of files page instead of the apache page. What could be wrong ?
by Hemant March 5, 2008 at 4:21 amBy listing of files I meant that it shows me directory listing of htdocs dir instead of apache page. Please help. Thanks.
by Hemant March 5, 2008 at 4:24 amGreat Article! Worked great….now for MYSQL
by Greg March 20, 2008 at 2:56 amThank you so much. I managed to get php working under windows with IIS but it was so much hassel. It too me about a week. Now I have vista with no web server. I followed you instruction and had php working under an hour. Thanks so much!!!!!!
by Andre Ewen March 20, 2008 at 10:45 pmAs others have reported, I also get a 404 Not Found Error when trying to access the test.php file via http://localhost/test.php, which is within /htdocs/.
I cannot find a solution or cause to this issue. Any advice really appriciated!!! Thanks for the steps.
by emit March 30, 2008 at 12:15 pmYo, I seriously was trying for hours and hours, trying to follow dozens of tutorials and instructions to get php working on vista for web dev purposes. I tried IIS and then tried manually installing php4 and then php5 and each time couldn’t get past the part about handler mapping cause it kept saying something about a module list. Then I tried installing Wamp server and I couldn’t get the localhost to do anything and I searched dozens of pages of forums. But anyway, as soon as I started following your instructions I knew it was going to work. It was so explicit and worked perfectly, and now I have apache and php on vista. YEAH!!!!
by Robb G April 6, 2008 at 7:16 pmSeems like most have configured PHP , but like most again, I am having trouble to have php work with mysql on vista under apache. PHP runs fine so far but cant connect to sql. What are the variables that need to be changed or added in php.ini anyone?
by fogi April 7, 2008 at 1:04 amThanks
SOLUTION TO MYSQL integration
Ok, for all of you stuck on mySql: If you have configured php to work with above help and if you are having proble to get mysql running and if you get error msg that corresponds to something like not able to load php_mysql.dll >>
first of all you have to enable
extension_dir = “Your php dir\ext”
and make sure you have
extension = php_mysql.dll in php.ini file
This should have been done already if you followed the instruction above.
11. Right-Click on Start > Computer. Choose “Properties”, then “Advanced”. Click on “Environment Variables”. Click on PATH, then Edit… and add “;C:\php;c:\php\ext” (without quotes) to the end of the variable.
now as instructed above, if you already added evironmental variable as phprc value “c:\php dir” (wherever your php dir is)
in the list look for
path=c:windows; c:\windows\system32;….
lilight it and chose ‘edit’ and add at the end of the list the same value that you added for phprc (above)
just make sure you add ; before “c\php dir”
path=c:windows; c:\windows\system32;….
path=c:windows; c:\windows\system32;c:\php
this should work just fine.
And I don’t think you have to add the path c:\php\ext in the environmental variable, just the path to the php folder should be enough.
by fogi April 7, 2008 at 4:02 amWorld is a happy place after all, specially when your mysqlstarts working. hmm time for a drink 🙂
Thanks a lot. This is very helpful.
by Masao April 10, 2008 at 3:59 pmYou made my day 🙂
by vu the cuong April 13, 2008 at 1:08 amThanks a lot for such a nice step by step instructions.
I could not get PHP started for a while, although I had the file C:\php\php5apache2_2.dll at the right location. Changed the permissions still did not help.
Finally when i changed my httpd.conf to C:\php\php5apache2.dll instead of _2 thing then it worked. (upto test.php – yet to upload my complete application though)
fyi – I have php5.2.5
by atul kumthekar April 13, 2008 at 6:43 amthanks man, great tutorial.
by linkin April 13, 2008 at 9:31 amwould be really nice if we could have one for mysql as well.
Perfect, First Time! Great instructions for installing Apache and PHP on Vista HP!
by Jonathan April 17, 2008 at 10:16 pmWow! It works!!
by Alice April 21, 2008 at 10:14 pmBought a book on PHP and MySQL today, fell at the first hurdle…thank you for making this easier, and letting me continue on my web developing journey! 🙂
Alice.
Thank you! Worked perfectly.
by Nick April 24, 2008 at 2:10 amGuys why not just used XAMPP. This is a very light way tool that can be installed with the click of a button. It is bundle up with Apache,perl,php,mysql,phpmyadmin. great tool check it out!
by Michael April 24, 2008 at 1:53 pmThanks a lot!
by Mario April 26, 2008 at 9:11 pmAfter a hard day I discovered your procedure. Amazing, it works. Now PHP is integrated with Apache, and work fine under Vista Home Basic. Your tutorial is a great thing.
Hey thanx that really works i have been trying all day to get apache and php working on vista ^^ next is to get my sql :s. thanx alot
by Alan Davenport April 27, 2008 at 12:49 pmYou Guys are rock! After reqding your above tips got the success to install the PHP on the Vista!
Cheers!!!
by JS April 30, 2008 at 4:50 pmJS
You Guys are rock! After reading your above tips got the success to install the PHP on the Vista!
Cheers!!!
by JS April 30, 2008 at 4:50 pmJS
As others have reported, I also get a 404 Not Found Error when trying to access the test.php file via http://localhost/test.php, which is within /htdocs/.
I cannot find a solution or cause to this issue. Any advice really appriciated!!! Thanks for the steps.
by pjb May 14, 2008 at 2:47 amThank you for this post. I generally work on Linux, but for reasons I’ll not bore everyone with, had to install the AMP part of LAMP on my windows install on the laptop. Everything worked smoothly except the PHP installer, which refused to work, and I seemed to only worsen it. This worked perfectly the first time though.
Thanks!
by Mike May 15, 2008 at 10:23 pmDo I really have to disconnect from the internet?
by keffie91 June 3, 2008 at 3:01 pmThank you for your step by step explanation on how to get php and apache server. Really appreciate!
by chuck June 12, 2008 at 3:20 amVista/IIS7/PHP/MySQL
I can’t get SESSION variables to work. Is this a permissions problem? The same code works fine on the Linux server and in XP, so I know it is a Vista issue.
[I know I am using IIS7 rather than Apache, but this is the best thread I have found, so ‘thanks’]
by Simon June 16, 2008 at 7:11 pmI just like the tutorial and my blank page appeared, then changed the last line of item 12 and functioned properly. Tutorial Great, thanks.
In item 12
by Furquim June 25, 2008 at 6:55 pmchange PHPIniDir “C:\php” for PHPIniDir “C:\php\”
Hmm, can’t seem to get mysql working…
I’ve got the environment variables set as:
yaddayadda;C:\php;c:\php\ext;C:\mysql\bin
And the ext_directory is set to:
extension_dir = “C:\php\ext”
I’ve tried adding the slashes as backslashes and forward slashes, as well as adding one at the end, no go…
And yes, in that folder is the proper dll:
php_mysql.dll
Still getting:
No MySQL extension
Help…. Please… 🙂
Ray
by Ray July 18, 2008 at 5:14 pmMan, a year after this was posted and this is *STILL* a lifesaver. THANK YOU SO MUCH for posting this and keeping this around. 2am on a Sat night and if I had any hair left it’d have been gone…
by Randy Cooper July 20, 2008 at 6:10 amHi
I have a problem after installing MySQL.
It gives me a error message in command prompt-
ERROR 2003: Can’t connect to MySQL server on ‘localhost’
by Shahriyar July 21, 2008 at 6:58 amI get a 404 Not Found Error when trying to access the test.php file via http://localhost/test.php, which is within /htdocs/.
I cannot find a solution or cause to this issue. Any advice really appriciated!!! Thanks for the steps.
by nadkins July 29, 2008 at 6:54 pmThanks so much ! It worked perfectly. I especially appreciate the vista tips – man is that stuff counterintuitive.
by matt July 31, 2008 at 2:36 amThis is fantastic. You are fantastic.
by Tom August 5, 2008 at 9:58 pmRay if you still have problem with mysql connection check if the php.ini is valid (I had upload_tmp_dir =|c:/php/upload” instead of upload_tmp_dir =”c:/php/upload”)
Good luck!
by Posey August 11, 2008 at 1:26 pmHey,
by Colin Ingham August 12, 2008 at 4:06 amthanks. I was really struggling to get that working.
Hi,
I have a problem displaying anything within the
tags. I did everything you said, and have Apache running on Vista, and localhost/test shows the panels to demonstrate PHP is installed, but when I create a trial file, with the following code
Agent: So who do you think you are, anyhow?
and save this in the root directory C:\Apache Software Foundation\Apache2.2\htdocs\ as a .php file, when i browse to the file and open, nothing within the php tags, nor the tags themselves, displays. I have tried this with IE7 and Mozilla and had the same result.. any suggestions?
by Ian August 14, 2008 at 5:45 pmhm seems i stuffed the above, i meant within the ?php … php tags, and the code was as follows with the > elements removed
html
head /head
body
Agent: So who do you think you are, anyhow?
br
?php
// print output
echo ‘Neo: I am Neo, but my people call me The One.’;
?
/body
by Ian August 14, 2008 at 5:47 pm/html
Hi,
I am stucked at a point..
all is I have installed the php,mysql,apache on my Vista home premium. all is working well but I want to change the path of the default php working folder.
what I did is just commented the default path and include new path in the httpd.conf (in apache/conf) file as below.
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot “C:/Program Files/Apache Software Foundation/Apache2.2/htdocs”
DocumentRoot “X:/php_project”
(X: is partition on my laptop)
I am not able to get the pages working here.
by King August 19, 2008 at 12:15 pmcan anybody give the solution??
thanks
Hi…
I tried for two days to install. I did every thing except copying the below lines in the apache config.
this information helped me.
LoadModule php5_module “C:\php\php5apache2_2.dll”
AddType application/x-httpd-php .php
AcceptPathInfo on
PHPIniDir “C:\php”
Now I could able to install.
Thank’s for the the help.
KrishnaKishore
by KrishnaKishore September 18, 2008 at 12:56 pmHi,
Thanks for the guide. It’s nice.
But I am having problem with mysql_connect()…I followed the instruction.
Still it’s not working.
I using windows vista. Any help/solutions??
Arjun.
by Arjun September 29, 2008 at 9:17 amGloomy tales xxx tube ksi
by Sojeyjnm October 2, 2008 at 10:18 pmThanks for this article! Vista is like a demon when trying to install PHP! Have bookmarked this page and saved it to file for future reference!
by Wayne October 5, 2008 at 7:43 pmhi i’m trying to configure a vamp but theres a problem that i encounter i cannot save my work in C:/windows/driver/etc/hosts
by jhoe shon October 6, 2008 at 8:33 amthe error pup ups that the file that i change cannot save at this file
Very interesting tale www pichunter 😯
by Dsoneuva October 7, 2008 at 7:54 pmperfect design thanks porntube videos 19412
by Zxctrrqw October 8, 2008 at 11:32 pmthis post is fantastic free streaming porntv 1892
by Owsstxnk October 9, 2008 at 7:36 pmOk, I followed through every step on here and cannot seem to figure out my issue. I have successfully loaded apache 2.2.9 and PHP 5.2.6 The Apache Service Monitor shows on the bottom that both are running. Here is my issue
When I go to my test page which is phpinfo.php the file trys to download. To at least see see the phpinfo(); results I added it to the body of the base index.html that comes with apache. Thre result is that the “It works!” part of the html displays, but not the PHP. Anybody have any suggestions. I have no errors and checked my paths both in the php.ini and httpd.conf and everything seems correct, I am getting no errors. I did try to change the php loadmodule command to use php5apache2.dll instead of php5apache2_2.dll and it made apache error and not load. Also I have shut off UAC to make sure there were no permission issues.
Any suggestions would be helpfull, I am getting frustrated
by Brian Kucharski October 9, 2008 at 9:01 pmAfter all the checking and rechecking you think you are going mad. Here is what my issue was. After I posted the message I went back through step by step verifying each entry letter by letter and wouldn’t you know I had the following in my httpd.conf
AddType application/x-http-php .php
Instead of
AddType application/x-httpd-php .php
One little letter off and it did not work and no errors. Added the d to http and everything worked like a charm. Always pays to check entries letter by letter.
Thanks again for the post it helped everything except my typing. ;>)
by Brian Kucharski October 9, 2008 at 9:33 pmIf you encountered no noticeable errors during the build process but you are not
seeing the appropriate output, it may be due to one or more of the following reasons:
• Changes made to Apache’s configuration file do not take effect until it has been
by Munyua October 16, 2008 at 7:34 pmrestarted. Therefore, be sure to restart Apache after adding the necessary PHPspecific
lines to the httpd.conf file.
• When you modify the Apache configuration file, you may accidentally introduce
an invalid character, causing Apache to fail upon an attempt to restart. If
Apache will not start, go back and review your changes.
• Verify that the file ends in the PHP-specific extension as specified in the
httpd.conf file. For example, if you’ve defined only .php as the recognizable
extension, don’t try to embed PHP code in an .html file.
• Make sure that you’ve delimited the PHP code within the file. Neglecting to do
this will cause the code to output to the browser.
• You’ve created a file named index.php and are trying unsuccessfully to call it as
you would a default directory index. Remember that by default, Apache only
recognizes index.html in this fashion. Therefore, you need to add index.php to
Apache’s DirectoryIndex directive.
• If you’re running IIS, make sure the appropriate mapping is available, as shown
in Figure 2-2. If not, something went awry during the FastCGI installation process.
Try removing that mapping and installing FastCGI anew.
Hey, installed Apache and PHP but when want type localhost/test.php in my browser, it says “The requested URL /test.php was not found on this server.” Why is it so? Hope you can help me ^^ Thanks.
by karleen October 28, 2008 at 2:26 amI install everything but I still can’t run test.php
This is the error:
The requested URL /test.php was not found on this server.
Also I would like to know where in httpd.conf I should type folowing lines :
LoadModule php5_module “C:\php\php5apache2_2.dll”
AddType application/x-httpd-php .php
AcceptPathInfo on
PHPIniDir “C:\php”
Becouse I don’t have C:\php folder
My php folder is in C:\wamp\bin
thanks
by baltazar November 12, 2008 at 6:55 pmWas having trouble installing Apache and then PHP on to Vista SP1. This worked perfectly! Thanks heaps!
by Rachel November 30, 2008 at 9:10 amthxs alot for the tutorial, never got installing php problem in every platform except vista. too many time lost to find the problem. once again thxs!!
by erwin December 19, 2008 at 7:06 pmSuper !
by Aleš January 16, 2009 at 9:06 pmTHX
after two days i got it running 🙂
You rule !
Vsaka čast, še enkrat hvala.
Priporočam!
LP
Hi , i tried all ways which is used step by stpe but still i can’t test test.php file ..
Error :
The webpage cannot be found
HTTP 404
Most likely causes:
There might be a typing error in the address.
If you clicked on a link, it may be out of date.
What you can try:
Retype the address.
Go back to the previous page.
Go to and look for the information you want.
More information
This error (HTTP 404 Not Found) means that Internet Explorer was able to connect to the website, but the page you wanted was not found. It’s possible that the webpage is temporarily unavailable. Alternatively, the website might have changed or removed the webpage.
For more information about HTTP errors, see Help.
any one help me ? why i am getting this error still..
I used below these two s/w’s are installed on my vista Os
1: apache_2.2.11-win32-x86-no_ssl
2: php-5.2.8-Win32
Apache is working fine .. but PHP not working .
by bala January 31, 2009 at 8:18 pmconf file has been editted as per posted steps .
is still i need to add any thing to get this thing come end ?
hi friends,,
now its working .. really super site ,,, small error in file name, thats why its was not worked ..
test.php.txt this is the error..
i corrected after long searching … test.php ..
this is rally my mistake .. but this site is really superb ..
thanks to all ..
by bala January 31, 2009 at 9:15 pmbye
Dude, you saved my life. I’ve spent the last four days looking for a site to help me install this onto my laptop.
Very good job.
by TweakedGex February 2, 2009 at 4:56 pmFor those who are receiving the ERROR 404 File not Found when you are testing PHP for the first time with the “test.php”. Make sure when you create the file in Notepad that you do the following:
A) Open Notepad Start -> Accessories -> Notepad.
by David March 23, 2009 at 1:02 amB) Type
C) Save As “All files” (ie: NOT TEXT FILE!)
D) Explicitly give it the php extension “test.php”
DAMMIT! Why didn’t I scroll all way down and read Bala’s comment! That would’ve saved me an hour of frustration and I wouldn’t have repeated him. DAAMIT!
by David March 23, 2009 at 1:04 amHi,
Use WAMP Server
Automatically install all necessary application!!
Trust me, I have Checked few of PHP local servers and
came to conclusion that WAMP Server IS the best out there.
Easy to install, Intuitive to work with.
Great software for all PHP developers out there.
If you using Skype while working on developing
Make sure to start WHAP before Skype (and not the other way around).
That the only “bug” I have found.
Strongly recommend to use it!
by Amit March 29, 2009 at 12:07 pmI was able to run the installer in Vista 64, home premium, after following your steps to “turn off user access control” and then start the console as the administrator.
Within the console, I could run the installer command:
msiexec.exe /i php-VERSION-win32-install.msi
which seemed to do the right thing.
by Mike Caron April 16, 2009 at 1:34 amTHANK YOU SO MUCH. This was such a help.
by Yoshi April 19, 2009 at 9:19 pmPlease let me know if there are any equally great sites like this you can recommend to me. Thanks Again
by visit May 20, 2009 at 9:54 amI dont think WAMP is good to use, i prefer to do manually. It is much better and not that complicated
by Patelligence June 4, 2009 at 4:57 pmThank you so much! I have been struggling all day-using a book that I actually paid good money for. Your free advice was so much more useful!
by maria June 20, 2009 at 2:20 amThis is the error:
“Not Found
The requested URL /AirAlliance/web/AirAllience/index.php was not found on this server.”
I was trying to run the sample, I’ve already set up the apache server and it says “It works”, now, i was trying to run the php info and an error message occured says, “Forbidden” or 403, or sometimes 404, please tell me what to do? i want to pulled my hair in my head, almost 2 nights that i am very frustrated…
by cheche_leche June 24, 2009 at 12:02 pmHi
Thanks very much for the tutorial. I used your tutorial on apache to install apache and managed to get it running. I have used your php tutorial to try and install php.
When I try to load the http://localhost/test.php it asks me if I want to open the file or save it. I chose to open it and it shows me the php info code you told us to type in.
Could you please suggest what I could have done wrong.
It is my first time installing php as I have just decided to start learning php.
Thanks very much
Regards
Mike
by Mike June 28, 2009 at 7:33 pmHi even i get de code tat u asked to type.. wat shud i do now?
by sri July 3, 2009 at 2:02 pmIam badly in need of ur help…pls help me out na.. thanks a lot in advance.
by sri July 3, 2009 at 2:04 pmProblems I had (I think 1 and 2 came from having a different .msi file than when you made the instructions and 3 just needs clarification for people like me):
1. I could not find all the dll’s you listed (I am going with the the included in the msi for the moment.
2. I did not have the file php.ini-recommended so I left the php.ini that was already there.
3. I was not sure where to put the 4 lines:
LoadModule php5_module “C:\php\php5apache2_2.dll”
AddType application/x-httpd-php .php
AcceptPathInfo on
PHPIniDir “C:\php”
So I put the LoadModule at the end of the LoadModule statements; the AddType at the end of the AddType statements; and the other two lines at the very bottom.
4. AND THE BIGGEST PROBLEM — MS’s notepad appended .txt to test.php so it was test.php.txt and I spent 4 hours trying to figure out why everything seemed to look like it was working except I kept getting a 404. I dropped the .txt suffix and it worked as described.
Now to do my homework and hopefully get good file access. But that is another problem.
by Natalie Holeman August 28, 2009 at 8:04 amI have followed this tutorial, but i got to place that i can’t find the PHP 5.2.3, i spent almost three days trying to firuge something out with PHP4 but never worked out.
I have installed Php 5.3.10 with apache2.2 and mysql and evrything work well.
all the confuguration went okay, i tred test.php and it worked well, but when i upload my website that i have done it on window Xp, i couldn’t connect to mysql when i hit connect on the webpage it gives me the http404 error, does anyone had this problem.
i was serching the net, i have a feeling that this is caused because i am using vista ultimate, so the code i different from php4.
code difference
i hope i will be able to fix, so i can continue doing my website.
by Ralf September 7, 2009 at 8:46 amit works!!!!!!!!!!!!!!!!!!!!! Thanks a lot!!!!
by Pepe October 19, 2009 at 6:30 pmThank you so much for this excellent and effective solution. I’ve been struggling with this installation on and off for a few days now, and your solution got me up and running. You Rock!
by Karen February 19, 2010 at 12:19 amThank you, really useful information!
by Igor July 8, 2010 at 12:25 pmI am having very little luck with this- followed your instructions but apache won’t load the php module. The debug says that “php5apache2_2.dll” isn’t loading, and a quick check reveals that no such file is in the php folder! I have downloaded the most recent stable version, so why is this? Any help greatly appreciated!
by nye January 20, 2012 at 5:13 pmThanks!!!!!!!!
I tried install php this weekend, then following your instructions this work!!!!!
I not wanted install combo php+apache+mysql, i wanted install each one, then i found your help…
Thanksssssssssssssssssss!!!!!!!!!!!!!!!!!!!!
by livia June 4, 2012 at 4:33 am