Monday, January 12. 2009Installing PHP on Windows 7
Microsoft have released the first public beta for their upcoming Windows 7 operating system. To me it looks surprisingly similar to Vista (which is a good thing and a bad thing
First of all, you need PHP (obviously). Go to the PHP download page and grab the latest non-thread-safe ZIP archive for Windows. As of writing this, the package is called "PHP 5.2.8 Non-thread-safe zip package". Unzip the archive to a folder on your hard disk (I use C:\php5) and create a copy of php.ini-recommended (or php.ini-production in recent PHP versions) called php.ini. There, add the following configuration setting:
cgi.force_redirect = 0This is the minimum setting you need to change to make PHP work with IIS. You may also want to use cgi.fix_pathinfo = 1, fastcgi.impersonate = 1, and set extension_dir appropriately. Then it's time to install IIS. You need at least the "Business" version of Windows 7, but the currently available beta 1 is Windows 7 Ultimate anyway. Go to Start/Control Panel/Programs/Turn Windows Features on or off and check on the Internet Information Services entry. Activate the World Wide Web Services/Application Development Features/CGI node and also Web Management Tools/IIS Management Console (the latter not shown in the figure). ![]() Now, start the IIS Management Console; just open up the start menu, enter inetmgr and hit Enter. There, navigate to the Sites/Default Web Site/Handler Mappings node and double-click on the "Handler Mappings" entry.![]() As a result of this, the Actions panel on the right hand side changes. You now see an option called Add Module Mapping. Clicking on it opens up a dialog which you fill out as you can see in the following figure (you may need to adapt the path used to your local system). ![]() If you do not see the FastCgiModule entry, you probably forgot to check the CGI node when installing IIS. Otherwise, close the Add Module Mapping dialog by clicking on OK. You need to confirm that you want to create a FastCGI application; click Yes. ![]() Finally, create a .php script and put it in the root folder of the IIS site (by default C:\Inetpub\wwwroot; note that you may need additional rights to write into that directory), e.g. phpinfo.php with a simple phpinfo() call in it. Call this script using http://localhost/phpinfo.php, and you are done!![]() Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
well, it really looks easy i think i am going to check it, well i wanna check the IIS stuff anyway, didn´t work with it since Windows 2000 Beta, so maybe i gonna try it out just for intrest.
nice one.. tnx
Will this tutorial work with the 64bit Version as well?
Guess this is vor x86?
Thanks, that works just fine. I'd been messing with this for a couple of hours and had lost interest. RTFM is I guess the message for me. all the changes you suggested for the PHP.INI are actually documented in the sample one - DOH!
All I've got to do now is try to get ZenPhoto working on this config - anyone?
Thank you so much for this! It works! For those that are scared to edit the .ini file, it seems adding the "cgi.force_redirect = 0" in any line under ; Error handling and logging ; will do fine
Is there any version of PHP for Windows 7 Home as I do not have the Business version?
see http://technet.microsoft.com/en-us/library/cc731911.aspx -- you can install IIS on these versions, as well.
In the download of 5.3.6, all you have to do is change the '1' to '0'...and the comments above that line tell you it is necessary if using IIS.
This was very helpful and quick, one problem though. I can't get captcha's to display properly when looking at them under localhost. I just get the broken image icon. Is there something extra that needs to be done to support captcha being able to display?
I guess your CAPTCHA implementation is the issue, not the operating system. Any error message the CAPTCHA script is generating?
I am not too sure though. For instance, when I upload the code one of my web servers I get the following :
http://www.revenantmedivh.com/captcha.php Works fine. I have uploaded this to another webserver and it also works. The code looks like the following: Any suggestions?
PHP Fatal error: Call to undefined function imagecreate() in C:\inetpub\wwwroot\legalsummer\captcha.php on line 5
Hmmm I seem to recall having this same problem at first on my old XP comp as well, but can't remember what i did before to fix it.
you need to enable the GD extension for PHP (extension=php_gd2.dll in php.ini)
Ah yes that got rid of that error, now I have a new one -__-.
PHP Fatal error: session_start() [function.session-start]: Failed to initialize storage module: user (path: ) on line 2 line 2 is simply: session_start(); so not sure why it's freaking out >
what is php.ini's session.save_path set to? The value needs to be set, the directory needs to exist, and it must be writable. HTH
It wasn't set previously, so I tried setting it to session.save_path = C:/php/tmp with and without quotes around C:/php/tmp and restarting IIS after each time.
The directory is created and has 'Full Control' permissions for every user on the list, and still get same error =/.
add the user IIS is using (IIRC it's IUSR_, but I am not sure)
Dude -- you are ALL THAT -- thanks,
-- Deck
Hi, good tutorial, it makes much more fun to have a tutorial on my side, when installing something like php
Thank you so freakin' much! I tried for hours yesterday, lol.. Being the first time and all!
Hi!
I did like the tutorial is shown. The IIS works and the localhost. But when i try to type the http://localhost/phpinfo.php it doesn't show anything. It's like it can't find the file... Someone had the same problem?
In my case .NET Framwork wasn't installed.
After the installation the problem was fixed.
Thanks for this - PHP newbie experimenting with WordPress on Windows 7. Worked like a charm.
Very clear and direct instructions. Thanks for taking the time to post it.
Wow! Really a great guide, no misshaps what so ever! Thanks alot guys (or girls)!
I'm having problems with MySql on Windows 7. The service won't start. Any ideas???
I can't get this to work. Think I'll just reside myself to the fact that I am old and stupid!!
This is nice and straight-forward. Works like magic. Thanks!!
An excellent and most helpful post - thanks very much. I tried this once before using Windows 7 (Build 7100) without success - anyone having difficulty with this post should insure they have the full release. Additionally I found that I also had to turn on a number of IIS components in order to get to the handler mapppings section. Now - on to MySQL ...
I did not have CGI installed in IIS. When I typed in FastCgiModule, I got an error message that it was not an option, so I could not proceed. I found a page on MSDN that provided steps for setting up CGI, but they did not work. I have Win7 Ultimate.
Here's how to add CGI:
To use the UI on Windows Vista or Windows 7 1. Click Start, and then click Control Panel. 2. In Control Panel, click Programs, and then click Turn Windows features on or off. 3. In the Windows Features dialog box, expand the Internet Information Services node. 4. Expand the World Wide Web Services node 5. Expand the Application Development Features node. 6. Check mark CGI. 7. Click OK. 8. Restart your computer.
Hi!
I did exacly tutorial is shown. The IIS works and the localhost. But when i try to type the http://localhost/phpinfo.php it says Not Found The requested URL /phpinfo.php was not found on this server. I install PHP 5.2.12 Non-thread-safe zip package on system window 7 unimate. Can you help. Thanks
When I clicked on HandlerMappings, it indicated CGI was disabled. In the right panel, there was an Edit Permissions link. Click on that and change to enable.
Download Microsoft Web Plataform Installer.
Follow the steps to install PHP. Be happy! Works with me. I have Windows 7 Professional x64.
dude...i downloaded the php 5.3.1 n extracted it ...but i found no "php.ini-recommended" file in it...it had only production and development..wat do i do??
use the "production" one, it replaces the "recommended" file. "development" replaces php.ini-dist.
Nup, followed all the steps to the letter, localhost works fine for normal html pages, but still fails to render PHP.
It finds the pages, just doesnt execute them properly, ie there is no error page appearing. Iv set the handler, and used Microsoft Web Plataform Installer. Which installs to program files x86. ANy help would be appreciated?
Hey thanks dude, been trying to install php in some other ways and it didn't work until i came across this forum... Thanks man, php works like a charm in windows 7 32 bit
Thanks a lot for your interest to help the community.
I am very happy to see the big page generated with the on Win7 64
Hey
Thanks for the tutorial but I cant find the file named php-cgi.exe so I stop at the third step of the tutorial By the way the version I use is the last one which is 5.2.13 and my system is 64 bit is there is any other .exe file that I should use instead of this one ?? Thanks in advance
which EXE files do you get in your distribution? Do you use the official ZIP package?
I downloaded PHP 5.3.6 tar file from the PHP website but even then i couldn't find this php-cgi.exe and so i stopped with the installation at the third step......i would be thankful if someone help me with this. Thanks in advance.
Cheers, Aravind
the TAR file is the source code of PHP. Windows binaries can be found at http://windows.php.net/download/ (there is also a link on the mail PHP downloda page).
m also facing the same problem.....wat to do now
use the binary distribution
This worked great! And on windows 7 too!
Note For those having an issue with the phpinfo() call: Copy this and paste it into the document Then execute it in the browser
hi your page really helped me a lot. the problem i got is the same with john. i downloaded the 5.2.13 zip package with my windows 7 ultimate 64bit. i started creating the script and http://localhost/phpinfo.php cant be located. its says page is broken. please help. thanks
hey thr is no php.ini-recommended file instead there is a php.ini-development and php.ini-production..which 1 do i save as php.ini???
php.ini-production is used for production systems; for development systems I'd use php.ini-development.
There is some problem to install php........my browser five error 404
i did following modification in php.ini
------------------------------- cgi.force_redirect = 0 cgi.fix_pathinfo = 1 fastcgi.impersonate = 1 set C:\PHP5\ext ------------------------------ following error come Oops! This link appears to be broken.
I installed this on windows 7 home edition, but when I try to browse, it is blank. any help will be greatly appreciated.
I am getting the same problem with the blank page. I have installed the .NET package(rebooted) but I still get the blank page.
anything interesting in the error log?
All who have a blank page with the given instructions:
You can choose one of these: 1. In php.ini set short_open_tag = off 2. put php in front of the command phpinfo()
Thanks a LOT! What a great post! I have been struggling with this for 2 days and the solution is so easy.
I think I hate windows 7 already
I'm not sure where my problem is: I'm using Windows 7 and downloaded Apache, PHP, and MySql but keep getting an HTTP 500 Internal Server error. I have the php file in the htdocs folder however the error keeps appearing. Can you help? Thank you.
What do you put in the phpinfo.php ?
I've put "phpinfo()" in there then went to the localhost site and it just shows "phpinfo()" ...
did you use
[opening angle bracket]?php phpinfo(); ?[closing angle bracket] ? [the commenting system here seems to strip angle brackets]
thank you very much
for Installing PHP on Windows 7
ojala que sirva ^o)..
quien sabe porque algunos programas en 64 bits no corren con mi windows 7 ultimate
Hi!
I did exacly tutorial is shown. The IIS works and the localhost. But when i try to type the http://localhost/phpinfo.php it says Not Found The requested URL /phpinfo.php was not found on this server. I install PHP 5.2.12 Non-thread-safe zip package on system window 7 unimate. Can you help. Thanks
Doesn't work for me on 64bit W7, just missing several steps in IIS instalation ...
Excellent Post! Just what I needed.
I found an auto install on http://php.iis.net/ Updated the Handler Map and good to go.
Guys am having a problem following this tutorial,,,, where am suppose to create a copy of php.ini-recommended called php.ini. I don't have that file in my php file. Its php 5.3.5
in recent PHP versions, php.ini-recommended is now called php.ini-production and php.ini-dist is now called php.ini-development.
It works great with Windows 7 Home Premium. My only issue was "inetmgr" didn't open it. I just typed Internet Information Services, and it popped right up!
Yep, it works like a charm.
Thanks for this crystal clear post!
I've tried twice before in the last 2 years without success. This guide really did make it easy. I was soooo tired of uploading a million times to test & fix tiny errors.
I'm unable to know how to enable IIS in windows 7. Pls someone help me out.
Hi,
I follow the step but when I call phpmyinfo.php, there is the error This webpage is not available The webpage at http://localhost/phpinfo.php might be temporarily down or it may have moved permanently to a new web address. Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error. How do I solve this problem? Thanks,
Hello, I tried putting the script into the wwwroot file, but it will not let me. How Do i get around this?
works fine until i try to use following in my php script : mysql, odbc, 3rd party odbc driver - then php crashes whenever i call round() with data retrieved from a mysql query. if i try disable the opening of my odbc connection, the mysql queries and calls to round work fine. if try replace the retrieved numbers with hardcoded numbers, my php calls to round work fine. anyone know how to install isapi php 5.2.17 on win 7 x64 ?
if ISS worked then PHP must work;i guess you forgot to put the code in phpinfo file the code is
i guess this will help
cool! it works! thanks!
You have the best instructions. It took forever but once I found your site, it finally works!
I'm a begginer at this so can anyone explain how to script file and exactly what to put in it and how to call it? Thanks!
This is a simple php script.
1. Create a welcome.php file. 2. Put it to the root folder of the IIS. (c:\inetpub\wwwroot) 3. Open a web browser and type your ip address. (http://xxx.xxx.xx.xx/welcome.php) 4. The end.
Thank you. very detailed. extremely easy to follow. very much appreciate.
which version/distribution are you using? Binary version or TAR archive?
I want to thank you for the instructions on how to install php on windows 7. I've been trying to make php work with apache server because everyone tells me that the two are very compatable. Well after 3 days of troubleshooting I decided to use IIS server instead. With your instructions it took me all of 5 minutes and it works great. Thanks a million!
Hi there. Please help me out. I tried following this instruction several times but it seems like there is something wrong. I downloaded PHP 5.3.6 (tar.gz) and PHP 5.3.6 (tar.bz2), tried each one of them but still I'm getting "C:\php5\php-cgi.exe cannot be found" error. I did follow the instruction 1 and but this one is not working. And one more thing, "set ext_dir" what does that mean? Do i need to include than in php.ini? How do I do that?
use the Windows binary distribution (.zip), see "Windows Binaries" link on down the PHP download page.
extension_dir (not ext_dir) is a setting in php.ini, I fixed the text, thanks!
I did everything but I am getting 'Internet Explorer cannot display the webpage' when trying to launch the page. Anything I am missing?
try using a different browser without "smart" error messages to provide more diagnostic information.
thank you Sensei
I think its working fine but it is giving a message while calling phpinfo() function in firefox,
the message looks like "PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Kolkata' for '5.5/no DST' instead in C:\inetpub\wwwroot\phpinfo.php on line 10" Also the url http://localhost/phpinfo.php returning an "HTTP 500 Internal Server Error" while opening on IE9
actually, the error message is quite helpful. Edit php.inin and add something like this:
date.timezone = "Asia/Kolkata" The warning should vanish then.
I'm having the same problems...but when I went to my .ini file and changed the date.timezone settings, it still didn't work.
Here's my code for that section: [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ;date.timezone = "America/Chicago" ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 etc. I tried placing American/Chicago without the quotes too...it didn't work.
remove the semicolon in front of the date.timezone line.
hey...
i successfully did all this but my php script is not being processed. HELLO IN HTML gives output: HELLO IN HTML what should i do ?? Please reply
I did like the tutorial is shown. The IIS works and the localhost. But when i try to type the http://localhost/phpinfo.php it doesn't show anything. It's like it can't find the file... Someone had the same problem?
i am having same problem bro. !
now what to do ???
Thank u sooooooooooo much!
u make me survive with this!kiss kiss!
thank u very mch....aftr R&D for almost 4 hrs, succesfuly installed php using ur site....thnx a lot
hhhhhhhhhh
Very useful post.
Thnx
its working.....
Thanks a lot...............
I am running Windows 7. When I run inetmgr I get an error message.."Cant find....." Anyone has this problem?
I guess IIS is not installed. The paragraph above the first screenshot briefly explains how this can be done.
thank you very much, a most helpfull guide for a newb like me ^__^
Thanks for this information it helped
I'm not sure where my problem is: I'm using Windows 7 and downloaded PHP but keep getting an HTTP 500 Internal Server error. I have the php file in the htdocs folder however the error keeps appearing.
Where do you have your PHP files at? If you have them under your c:\users\ somewhere then IIS does not have permission so it won't work. Try to move them to c:\php
IIS does not use htdocs by default, but C:\inetpub\wwwroot.
Thanks for the post, its unfortunate I did'nt find your post earlier !! it could havce saved hours of messing. Thanks for sharing
I followed all the instructions but I get to the point where I call the php script in the browser using localhost/phpinfo.php and all I get is "No input file specified"
Can anyone help?
i am also having same problem Rob,but when I specify file name then i can access the file but i don't think WE are doing right.
please help us ...!
ïðÿìîãî ýôèðà ßíäåêñà? À ïîä
Îíè îòíîñÿòñÿ ê ôåñòèâàëþ êîòîðûé
I cant find the php.ini-recommended in php 5.4.4.... please help me with this and also what request path we should add in "add module mapping" dialog box.
The files are now called php.ini-development and php.ini-production, see this comment:
http://www.hauser-wenz.de/s9y/index.php?/approve/comment/48191/280-Installing-PHP-on-Windows-7.html#c47853 For the request path setting, use *.php as you can see in the screenshot above.
Great job!
thanks for this information
its really working thanks!!!!!!!!!
step to step work on how to install php5.4.6 on win 7 x64..
having serious problems in installing it.. pls help plssss...///
Thanks very much.
Simple but to the point tutorial it works in 1 go:-)
Thank you for your neat and clean work.
it works perfectly, thank you!
I did everything but when I do the last step: Finally, create a .php script and put it in the root folder of the IIS site (by default C:\Inetpub\wwwroot; note that you may need additional rights to write into that directory), e.g. phpinfo.php with a simple phpinfo() call in it. Call this script using http://localhost/phpinfo.php, and you are done!
then I only see phpinfo() in my web browser.....where did I go wrong?
phpinfo() is a PHP call, so you have to enclose it in PHP tags. See http://www.php.net/manual/en/language.basic-syntax.phpmode.php
missing
◾fastcgi.logging = 0 - FastCGI logging should be disabled on IIS. If it is left enabled, then any messages of any class are treated by FastCGI as error conditions which will cause IIS to generate an HTTP 500 exception. |
Calendar
QuicksearchArchivesSyndicate This BlogCategoriesFriendly BlogsBlog Administration |
|||||||||||||||||||||||||||||||||||||||||||||||||
