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 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 ext_dir. 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.
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
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?
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 installed this on windows 7 home edition, but when I try to browse, it is blank. any help will be greatly appreciated.
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] |
Calendar
QuicksearchSyndicate This BlogCategoriesFriendly BlogsBlog Administration |
|||||||||||||||||||||||||||||||||||||||||||||||||

