Installing PHP 5 on IIS in 5 simple steps
Yes, yet another PHP 5 installation guide. Why write one when there are already dozens of them out there? Well there are two main reasons: firstly I will be writing a lot of guides that require PHP to be installed and working and I will need something to point people to who have yet to install PHP. Secondly, I have read a lot of the guides out there and found that a good portion of them over complicate the process. It really should not be that hard or perplexing. In this guide we'll break down the process of installing PHP 5 on IIS into 5 simple steps that are easy to follow that works for IIS 5, IIS 5.1 and IIS 6.
So what are these 5 simple steps? In a nutshell, this is all you need to do to install PHP 5 on IIS;
- Download and Extract PHP 5 (we'll install PHP 5.2.1 on IIS 5.1 in this guide)
- Set your environment variables
- Set the PHP application mapping in IIS
- Configure php.ini
- Restart & Verify
Just before we continue I thought it pertinent to mention that it if you have already installed, or attempted to install PHP on your system then you must remove all traces of that install before continuing. If ANY PHP files exist anywhere else on your system that are accessible via the PATH environment variable, then it is very possible (even probable if the previous version of PHP was different) that you will have issues with hosting PHP content.
If you are wanting to install PHP 4, then the process is slightly more complex than installing PHP 5 and involves steps not covered in this guide. Not to worry as it is even easier for you. All you have to do is download the IIS Aid PHP Installer from this site and run the fully automated GUI installer. This installer will completely setup your PHP 4 environment, including all environment variables, IIS scriptmaps and IIS 6 web extension. The particular advantage of this installer is that it configures PHP 4 to use FastCGI mode as well as an Opcode cache for maximum performance. Expect to see some articles of just how much faster here in the future.
1. Download and Extract PHP 5
Nothing taxing about this, simply go to the PHP download page and download the latest PHP zip package from under the "Windows Binaries" section, along with the latest PECL Win32 binaries (do not get the ones marked "non-thread-safe" unless you plan to use CGI/FastCGI as otherwise you run the risk of a race condition). Save the PHP zip package to the directory where you will want to install PHP (e.g. D:\PHP), and then extract. Once extracted you'll see inside your PHP installation directory a sub directory called "ext". Save the PECL Win32 binaries download into it (e.g D:\PHP\ext), and then extract. Your PHP install directory should now contain all the content of your PHP zip package file, and your ext sub directory should contain the contents of your PECL Win32 binaries file. From here move back to the root of you PHP installation directory (e.g. D:\PHP) and create three directories, one called sessions, one called upload and one called log. In the log directory create a new file called php.log. First step licked.
| Attachment | Size |
|---|---|
| chglist.zip | 3.19 KB |
- 83647 reads








Excellent Guide
This is fourth set of instructions that I am looking at to get PHP to work. For some reason mmc.exe would stall each time I would attempt to use Window's IIS GUI to associate .php with the dll. Hence the IIS would not parse the php pages.
Running that VB script did the trick (I just had to modify the Root directory letter once the script was finished).
Thank you for such an excellent guide.
No problem, glad it was
No problem, glad it was useful for you.
PHP5 and MySQL5
Thanks for your good job. Your guide was a precious help. Thanks to it I could finally install PHP5 with MySQL5 on IIS. Really nice work!
Is it just me?
Or are the graphics in this post broken?
It's not just you, the
It's not just you, the images are not being displayed for some reason. Have a feeling that my server side HTTP cache might have an issue or two. I'll fix it tonight when I get home, so check back again in around 12 hours or so. Thanks for letting me know :)
*EDIT*
Should be working again now :)
prompt for downloading .php file
Great tut!
but if i do all the steps and test it at the end, internet explorer prompt to download the .php file... :-S
It is in the root of the webserver, tried other locations too, but with the same result...
any explenation??
tnx
Do you have a mime type
Do you have a mime type setup for PHP?
To make things a little more clear
You can't do an include or a virtual include to test the php page for some reason that didn't work. Alll I did was made an
<a href>tag that references the phpinfo.php page in the default.htm of the server directory and clicked on it to test the php implement.Spelling and Grammar
Check your spelling and grammar. Readers may loose confindence in the technical portion of the article if the non-technical language has spelling and grammars errors.
Promt for downloading .php file
I get the same problem, I have made a href i another html file where I link to the php file, and yet it wants to download the file. I use IIS 5.1, followed all the steps.
For those of you that are
For those of you that are being prompted to download their php files rather than them being processes server side, double check you application mapping settings as per figure 9 above in the article. The ONLY way I have been able to successfully get IIS 5.1 to prompt to download a php file rather than process it is if the application mapping is incorrect. IIS will not let you save the mapping if the path to the php5isapi.dll is incorrect, so be sure that you have .php as the extension. If you have IIS Lockdown/URLScan installed, then you will need to add .php to the allowed extensions list.
Sorry about any spelling/grammar errors. I do my best, but unfortunately I am a product of the spell checker age and as the text editor on this site is very basic and doesn't have a spell checker there is bound to be the odd mistake that gets through. Feel free to point any mistakes out.
This might be your problem
Brashquido, I believe I have my IIS and PHP5 set up correctly and this how I test it:
http://localhost/[serverDirectory]/phpinfo.php
so for example I test my phpinfo.php page as follows:
http://localhost/ServerDir/phpinfo.php where ServerDir is my virtual server directory.
I think a lot of people are testing their pages like this:
C:\[serverDirectory]\phpinfo.php
so it would be like I was doing this:
C:\ServerDir\phpinfo.php
This prompts me to download the .php file, if others are doing this just make sure you're testing it with the localhost url.
-Brandon
That's a very good point
That's a very good point Brandon. For PHP scripts to be properly processed you need to access you PHP scripts via IIS, not windows explorer.
Restart your server
Thanks for this excellent article Brashquido! I do have a newbie question though. When you say "Restart your server..", is it enough to stop and start the web services in IIS, or does the whole machine need to be rebooted?
The main reason to restart
The main reason to restart your server is to update the environment varaibles. A restart might not be necessary, but it is one way to be sure the environment is refreshed properly upon install. Restarting your IIS services could well be enough. When you do it be sure that the Path variable from under the Environment section of the output of your phpinfo.php file contains the correct environment variables.
Disabled Buttons
Hello Brashquido,
For some reason i could not add new mappings through the gui using iis5.0 because the OK button was disabled at the add menu in the configuration. But thanks to your great tutorial which points to a very nice script i could add the mapping. I have two more questions that i will be glad if you could answer. 1-Do you have an idea about why i am facing this strange problem about disabled buttons in the add mapping menu(i am new to web programming maybe its not strange but couldnt find info on the net)
2-My need was to add .html and php-cgi.exe mapping so that i could view embedded php. Now its working fine at last,but only for the root directory. So if i create a new virtual directory although it works for the root directory and i still see .html in the mappings for the new virtual directory, i cannot have the php code executed at the virtual directory- like in the initial situation.Why do you think this happens?
Thank you very much,
Dennis
Re: prompt for downloading .php file
I got the same problem as well. Upon inspection, i noticed that the Application mappings for the "Websites" (the one that was added to in this article) and the Application mappings in "Default Web Site" (under Websites) were inconsistent.
I fixed this problem, by following the same instructions in this article on doing the application mapping, except, i right clicked "Default Web Site" and selected Properties->Home Directoiry tab -> Configuration button and did the mapping from there.
That's correct. If you add
That's correct. If you add your PHP application mapping at the root, then only websites created after you add the mapping will inherit the mapping. If you have existing websites you wish to use PHP on then you'll need to add a PHP application mapping at the site level.
@Dennis
At a guess I would say that buttons are grayed out due to a permissions issue. Not sure though as it has been a few years now since I'e worked with IIS 5.0 in depth. Make sure you are using a user account with full administrator privileges. Second issue sounds like your execute permissions are not set to enable cgi. This setting is in your virtual directory properties under the virtual directory tab. Make sure it is set to scripts and executables. If you have any further issues I'd appreciate it if you could post them in the forums so it does not fragment the comments discussion on this article. I'll be more than happy to help you out.
where is the popup menu?
Hi Brashquido,
I'm so new to PHP. Hope you can help me. I'm testing a php website in my computer 1st using IIS (running windows XP Pro). I already installed PHP 5.2.3 & pec, learned from ur tutorial, & also the configuration. The website i'm testing is begin with index.php contains popup menu from other directory i.e. /gbl/inc/menu_param.inc.php.
But i cannot let menu_param.inc.php go into index.php when typing "locahost" at Internet Explorer.
Or any settings i need set for that?
- William
Hi William, I'm not 100%
Hi William,
I'm not 100% sure on exactly what you're asking, but from what I can gather is that you PHP app is not initialising a menu as it should. In the setup of some PHP apps you need to specify the URL the app will be served from, and if your app is accessed from any other URL then it might cause problems. Double check that you are accessing your app via the URL you specified during setup. You may need to add an entry to your hosts file so that the URL you specified resolves to your localhost, e.g www.yourdomain.com resolves to 127.0.0.1.
Thanks
Just wanted to say thanks for taking the time to write this tutorial. I installed php and mysql with apache before, but it's been a while, and I'd never worked with IIS before until recently. This was a great tutorial to get me up and running quickly, everything worked like a charm.
http 500 error
I followed steps above to install PHP 5.2.3 for IIS 5.1. But when I test it, I got HTTP 500 error. Any solution?
A 500 error could be caused
A 500 error could be caused by a few things. Most immediate one that comes to mind as I had to deal with it just the other day is the fastcgi.impersonate setting in your php.ini file is set to 1.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Uninstall PHP 5
Great article. I had PHP 4 installed, but the PEAR option was not installed. So I thought to Uninstall and install a version that had PEAR. Everything was working fine PHP4. I uninstalled, reboot, and then reinstall PHP5 using the MSI installer. However, my PHP webpages came back with an 404 error.
Whats the best way to uninstall and remove all PHP related files from my Win2003 server? and to a complete reinstall following your instruction.
Thanks.
Ricky
Might be worth double
Might be worth double checking that you enabled a web service extension for PHP5 before we look at removing all things PHP from your system. Without knowing how PHP has been installed on your system there is very little chance of me being able to tell you exactly where and what to look for, but I can give you a general guide;
1) Ensure paths referencing PHP are removed from the PATH variable
2) Delete all PHP files
3) Check your windows system directories for PHP files which are sometimes copied over from the PHP directory when the PHP paths are not set correctly during setup.
4) Delete all PHP web service extensions from IIS
5) Delete all PHP application mappings from IIS
That should about cover all the obvious ones I can think of for now...
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
a perfect worl a perfect guide
I NEVER write comments on these sites. For your guide I had to. VERY good job. 7th instruction set. Worked like a CHARM
Very strange PHP session problem on IIS5, IIS6
Hi Ryan,
i installed PHP on my IIS5 (XP Pro), IIS6 ( win2k3 server SP2 R2) , everything works fine, except PHP session.
my server IP is 192.168.1.60
test.php
< ?
session_start();
?>
if i open this test.php like this: http://localhost/myweb/test.php, no error occur, but if i open the test.php like this: http://192.168.1.60/myvdir/test.php, it says:
Warning: session_start() [function.session-start]: open(C:\WINDOWS\TEMP\\sess_ii5515gqj838mhpugm5lr267e2, O_RDWR) failed: Permission denied (13) in C:\MyWeb\test.php on line 2
Warning: Unknown: open(C:\WINDOWS\TEMP\\sess_ii5515gqj838mhpugm5lr267e2, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
any idear?
Thanks.
Jaive
Hi Jaive, Can you open your
Hi Jaive,
Can you open your php.ini file and find the line with the session.save_path directive in it? Once you've found it post back here with the entire line.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Newbie questions
Hello Dominic,
I have a few questions as a newbie using IIS and PHP 5.2.x for you. I'm just getting started using IIS as a subdomain of my site (http://xtra.thecafeunderground.net), mostly because my hosting provider is running the main site on Linux w/ Apache, PHP 4.3.1, and MySQL 4/5. I wanted a testbed for Drupal 5.2, and I've already got a SSL certificate installed (from CACert). My questions for you are as follows:
1. If I install PHP 5 per your instructions in the how-to, can I use a preconfigured PHP.ini file (for example, the one created using the IIS-AID installer after I remove the PHP 4 install)?
2. Do you recommend using any other tools for the testbed server besides PHP and MySQL? If so, are any of them open-source or free?
3. Do you have any other tips for a newbie wishing to use Drupal on IIS?
Please feel free to contact me when you can. Thanks in advance.
~ BeachBoy
Hi BeachBoy, 1) Mostly, but
Hi BeachBoy,
1) Mostly, but there are a few differences between PHP 4 and 5. For instance the MySQL client is loaded automatically in PHP4, but loaded separately as a PHP extension in PHP5. There also might be issues with paths and things. It could be done, but I'd think there would be fewer issues with just altering the existing PHP5 ini file.
2) Depends totally on what you want to do. PHP is by far the most popular open source scripting language around at the moment, and as such most open source web apps utilize this language. About the only other "must have" I'd say you need there is Perl (check out Activestate), and maybe if you're feeling like it RoR. Obviously you could also look into .NET for running web apps such as Dot Net Nuke.
3) Make sure you backup and just spend time with it. Only other Drupal specific thing I'd recommend you look at is Clean URL's (such as use on this site). There are presently only a few offerings for IIS that enable you to manipulate URLS to create this effect. I'd recommend having a look at Helicon ISAPI Rewrite Lite which is free, and then check out my guide in the "how to guides" section.
Let me know if I can be of any more help.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Installing PEAR on PHP5
Thanks for answering my pervious post. I reinstalled PHP4 and used your IIS-AID, however that did not work.
Uninstalled it again. and Installed PHP5 per your instructions. Worked like charm. However, the software i want to install is called VTCalendar, http://vtcalendar.sourceforge.net/index.php, I followed the instructions but can not get it to work. It requires PEAR to be installed as well.
I'm assuming PEAR is out of the box ready in PHP5, do you have any resources in installing PEAR on my WIndows 2003 Server?
Thanks
Ricky
What's the best extensions to enable for PHP on IIS?
Dominic,
I'm curious about one thing regarding extensions for PHP 5.2.3 on Windows XP using IIS 5.1... Which extensions do you recommend that someone enable in their PHP.ini file for the best functionality for most PHP based applications? I plan to use Drupal 5.2 as mentioned in my previous post, as well as some other tools (CiviCRM, a OpenID server, etc...). If you could recommend some extensions (or write a article on the subject), it would be very helpful to me and others interested in using PHP 5. Also, please explain what the Pear libraries are used for, and where do we (I) download them, install them in PHP and so on.
Thanks in advance
~ BeachBoy
@ Ricky Installing PEAR
@ Ricky
Installing PEAR should be as simple as opening up a command prompt, navigating to the root directory of your PHP install, and executing the go-pear.bat batch file. From there just answer the questions and you should be set.
@ BeachBoy
Enabling PHP extensions for IIS when using PHP as an ISAPI module is where things get a bit tricky, and you certainly do not want to go enabling PHP extensions unless there is a specific need. This is because a lot of PHP extensions are designed with the *nix multi process model in mind, where Windows/IIS uses a multi threaded model. This can cause major stability issues when using PHP extension that are not thread safe on Windows. Currently the only real viable way around this with PHP5 is to configure IIS to use PHP in CGI mode which is not effected by this, but this comes at the expense of a major performance hit (even using the new non thread safe binaries that significantly increase PHP CGI performance). If a PHP application requires a specific PHP extensions, then it will usually specify what one(s) it needs in its requirements documentation.
As for PEAR, have a read through the Wikipedia entry for more details. The PEAR package manager is included with the Windows distribution packages for PHP, and can be installed as per instructions above for Ricky. Again, if a web app requires a particular PEAR package, then that should be specified in the requirements documentation.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Woohoo! It works like a charm (so far)
Dominic,
Thanks for a very easy to follow install guide... I've now got my IIS Server setup for PHP, and I'm quite happy with the results. I don't know if anyone has mentioned this, but if you wish to use a PHP app that has an index.php file, you should set the Default Document section of the IIS manager to reflect this. Make sure you add it, then move it up the list before the iisstart.asp entry.
Regarding Pear, I'll be adding that as I need it. Now I'm off to test Drupal...
~Beach Boy
Thaks for a great guide!!!
But i followed it to a tee. However when i pull up the http://localhost/phpinfo.php page it doesn't error out it just says done in the left corner of IE. It does nothing. Any Ideas? Thanks again for the detailed guide and any help you can offer.
Jason
Ok, what version of windows
Ok, what version of windows are you using? Can you scan your IIS logs for phpinfo.php and post back the entire line if you find it?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Great GUIDE!! Just facing one problem...
Hi Brashquido,
Thanks for the wonderful step-by-step guide. I'm still having a problem with the prompt that wants to download the file rather that run it. I've checked the MAPPING settings and they are correct. I also tried using:
http://localhost:8020/phpinfo.php BUT it wants to save the file. Other html files work fine though.
Any ideas?
Thanks
PHP Code shows up in browser!!
Thanks for the great guide, but when I try the PHP test the code shows up instead of the page. It's like nothing gets processed.
I tried the small code you suggest and the same thing happens.
Thanks in advance
Great Guide!!
Thank you very much!! This has been my 5th attempt at configuring IIS and PHP. After all the rubbish advice from the first search results in google, i hit the next button about 15 time and found your site! Thank goodness!!
Again, many thanks for the advice!
Damien
If you are being prompted to
If you are being prompted to download php files rather than them being processed, then I'll stongly suspect that it is your application mapping. I know you said you've check it, but it is the only way I've ever been able to reproduce this problem. Double and triple check this, and if the problem continues feel free to send me a private message or use the website contact form to get in contact me as if the application mapping is not the issue I am as keen to find a resolution as you are.
As for php code being displayed in the browser window rather than being processed, then double check that your php code is enclosed in the proper php tags. Your php scripts may also be configure to use short tags, and if so you'll need to enable the short tag option in php.ini or modifiy your scripts to use the full php tags.
Thanks for the kudos Damien, glad to know the guide helped :)
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
THE BEST GUIDE FOR PHP
THANK YOU
BEST GUIDE
THANK YOU!!! your last comment fixed my problem!! Very good thinking and analysing of problems through posts, which my lecturer couldnt solve in 10 emails. Keep it up!!
Great Guide
This tutorial was a life saver. I attempted to install php 4 times before coming across this guide which was the first that I could follow from beginning to end. Much appreciated.
Only one thing missing
I had to enable read access to php5isapi.dll on IUSR_. Won't everyone have to do that?
You shouldn't have to give
You shouldn't have to give read access to the IUSR account unless the default permissions have been altered. Have you removed any of the default permissions from your PHP directory?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Excellent Guide for Beginners Like me.
This page is an excellent guide for new programmers. After installing php5 on IIS5 I spent many days breaking my head to make it work. Many other guides didnt help. Thanks to Dominic Ryan. KEEP IT GOING
John
Good Job But can you explain how to do it with Fastcgi Go live?
I think also this is a excellent guide.
But with so many expectations about using Fastcgi GoLive I would like your help about installing PHP 5.2 using FastCgi on Windows 2003
Thanks
AT
The php code isn't executing
Dude, tks a lot for your tut. I've done everything right. I tested the installation with the "test.php" page and it is displayed correctly. The only (but a terrible headache) problem is that every single page with .php extension isn't showing.
I mean, when i try to visualize some php page, my browser only displays a blank page, and nothing it''s working. I have checked my server, and everything is fine. Can anyone helpe me?
I'll look at putting
I'll look at putting together a FastCGI guide this week, or next week at the latest.
If you are getting blank pages, then you might like to make sure that your error reporting in php.ini is turned on. In particular make sure you have these settings;
error_reporting = E_ALL
display_errors = On
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
HTTP 500
Hi, nice guide there, though i have some problems between 'Program Files': "C:\Program Files\PHP\PHP5isapi.dll"
On execution of any PHP file, i get the HTTP 500 error, and IE7 wont give me more details. Im using WinXP Pro, IIS5.1 and PHP 5.2. Also i got MySQL 5.0 installed. my main reason for installing PHP on my IIS server is for vBulletin, though i cant seem to run any PHP application. Mappings are correct, Environment Variables are correct too, though i installed PHP in "C:\Program Files\PHP" and i got an error to put quotes around the address when making the mapping, and instead of the normal format: C:\windows\inetserv\asp.dll, my PHP executable is in qutoes because of the
Any help will be greatly appreciated, ill be waiting for a response
First thing I would try if
First thing I would try if you haven't already done so is turning off the "Show friendly HTTP error messages" option in IE7. This can be found by going to tools > internet options > advanced.
As a general rule of thumb I would steer clear of using directory structure with spaces in them, especially when dealing with software whose origin is from a *nix background such as PHP. That said I am sure I have had working PHP environments with the installation dirs in Program Files before, so without looking at the system I'm not exactly sure. One thing you could try is to use the 8.3 format naming convention when setting the path to php5isapi.dll, so it would look like this;
C:\PROGRA~1\PHP\PHP5isapi.dll
This way you wouldn't need to use the "" to enclose the path.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
problems
Good Day for all,
i´m install php 5.2.4, mysql community edition 5 on II6 and win 2003 server, and my problem is:
i´m test with phpinfo file and get next message:
"The system cannot find the path specified."
and i´m check enviroment paths, and everything is ok. could u give me some help?¡
The places you'll really
The places you'll really need to look at at your PHPRC and PATH environment variables, but as you've said you've check those I'd double check your PHP application mapping path in the IIS Admin control panel. For the moment I'd also advise you do disable all your PHP extensions in php.ini, just so we know PHP isn't looking for some other library related to your PHP extensions.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Getting error while creating chglist.vbs script
I have installed PHP on IIS. I had followed all steps upto creating chglist.vbs script. But at this step i am getting an error as
Windows Script Host
Script: D:......
Line:1
Char:1
Error: Invalid Character
Code:800A0408
Source:Microsoft VBScript compilation error
I found this script on David Wang's blog
Please suggest any remedy for the above error...
thnx in advance
Regards
Amar
If you downloaded the script
If you downloaded the script from my site and have not edited it at all then it should work. If you do edit it, make sure that you only edit it with something like notepad, as word processes such as Word will cause issues. For example the ' character which is the first character in the script will be saved as a ` if you save it at all from Word which is invalid.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
got it working at last
i finaly got php to display the test page thanks to your guide
but i have a question for u.......
dos ;extension=php_mysql.dll and remove the semi colan (;) conect php to mysql coz im having a real problem with something called joomla thats not leting me connect it to the mysql database.
thanks in advance
hempy =)
That's great hempy, glad the
That's great hempy, glad the guide helped! You are correct, removing the semi colan from the front of ;extension=php_mysql.dll will load the MySQL extension to enable you to connect to a MySQL database. Be sure to restart IIS in order to make the changes effective.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
same problem with blank page
I got the same problem displaying blank page without any error msg. I run the PHP as a CGI mode. my test page is
echo "php"; ?>
something
just the "something" display but no "php"
any reason?
thanks
First thing to do is to make
First thing to do is to make sure the display_errors directive in php.ini is turned on so that if there are any errors they are printed to your screen. Also, what do you mean exactly when you said you test page is "something"? You test page should contain something like this;
<?phpphpinfo();
?>
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
php code appear
I have the same problem:
When going to see my "phpinfo.php"
The only thin I see on my browser is the code of the file:
<?phpphpinfo();
?>
Thanks
Blank page
When I try test page phpinfo.php I can see only a blank page.
display_errors directive in php.ini is already turned on.
Any help please
Jos
The only way I've ever being
The only way I've ever being able to reproduce the problem where PHP code shows up in the browser is when the PHP tags are missing, not correct, or the short tags directive not being enabled in php.ini in instances where code is using short tags. It seems that you do have you PHP tags there, so I would go back and double check that there are no spaces in the opening or closing tags.
Blank pages are slightly more common, and when doing a simple phpinfo test usually come about because the PHP application mapping has not being setup correctly. I'd suggest going back through the guide from step two and double check all your settings.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
php.log
HI!
This is a great instruction.
Everything is working except some things.
I am using PHP 5.2.4, IIS 5.1, XP Pro SP2.
I hate that, if i change anything in php.ini, i should restart the whole OS, but this is the smallest problem.
I did set up evertything as you sad:
in my php.ini:
display_errors=On
log_errors=On
error_log = "D:\PHP\log\php.log"
with theese settings, if i make an error in a file, the apache server write the php.log.
But not the IIS. My file is there, but when an error occured, that is not writing anything into the file >:(
Vaso
Hi Vaso, You really
Hi Vaso,
You really shouldn't have to restart the OS for changes in php.ini. A restart of IIS should be enough here. As for your PHP log there are a few thing you could possibly check;
1) Have a look at your phpinfo page and make sure the correct path to you log is set.
2) You may need to grant the NTFS write permission to your log file for the IIS user account (IUSR_COMPUTERNAME).
3) Download the filemon utility and set it to monitor your log file which should give you a very good indication on where things are going wrong.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
THANK YOU!!!
I have been trying for days to get php5 installed on IIS5. It felt like a tried everything until I stumbled across this article. I followed the 5 easy steps and "wah lah" it worked. You are awesome. Thank you very much!!!
:D
Yeeeeeeeeeeeeeeees
Finaaly!
Hello there...
I have been tired with the times i have tried installing php 5 and finally i was able to do it easily with your instructions and quite successfully i tested phpinfo() files as well. Thank you for that...but still i hav that problem of opening files as to download when they are being tried to open via an html file... for eg : i want to open a run a php script which is written in a file called result.php and need to run in when the submit button of html page is pressed. but here as it is clicked it tries to download the file rather than running the script. i checked the mapping as u said and in the add filter i tried adding php but it says its not loaded and thats not working fine... what should i do to solve this problem.
please help me...
First, PHP should not be
First, PHP should not be loaded as a filter, it should be loaded as an application mapping. I recommend having a look at the "Set the PHP Application Mapping in IIS" section again. What happens if you access this results.php file directly rather than calling it via your form?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Http 500 error message for
Http 500 error message for all php pages... i installed in the same way as u said...
500 is an internal server
500 is an internal server error, so there must be something amiss with your PHP environment. Can you check;
1) Make sure there are no spaces in the path in your PHP application mapping.
2) Did you add PHP to your PATH variable
3) Did you create the PHPRC variable?
4) What PECL extensions do you have enabled?
5) Are you able to execute a simple phpinfo page as described in the guide?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
phpMyAdmin SOLVED!
If you get "the specified CGI application misbehaved" then you must use php5isapi.dll INSTEAD OF php.exe %s %S.
Spent couple of hours but fixed it. Please amend you article, if applicable.
Nice work, glad you got it
Nice work, glad you got it working. However, it is possible to get phpMyAdmin working with PHP CGI. If you are using PHP CGI and receive error messages such as you've described then it is likely that the CGI related directives in php.ini needed tweaking for Windows/IIS. Out of interest, what instructions did you follow that advised to use "php.exe %s %S"? If you were using PHP5, the PHP CGI executable is php-cgi.exe .
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Thanks
Thanks, your tutorial above is kick ass.. do you have tutorial step by step similar like above, but this one to install MySQL on IIS 5.1 to work with PHP 5.
Thank you before and I really appreciate it.
Glad the tutorial was of
Glad the tutorial was of some help. You can find a tutorial on how to install and configure MySQL 5 on Windows in the How To Guides section.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
reply
500 is an internal server
Brashquido | Tue, 2007-11-20 14:31
Well i have no spaces put in the filenames or in the link
Added php to the path variable and also "phprc" too
Pecl extension i hav only mysql one enabled. Have done it according to the instruction you gave above and was working fine with all php pages until i restarted the system. After that am getting http 500 error. Dont knw y it is coming nw.
pls help
Was this your first attempt
Was this your first attempt at installing PHP? Have you changed anything on your system since your last reboot? Are there any events in the event log that might shed some light
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Re : Was this your first attempt
as you said i have disabled the friendly http error and then i got this message "%1 is not a valid Win32 application. " will that help you to trobleshoot.
What exactly have you set
What exactly have you set for your PHP application mapping? With PHP5 your application mapping should be either;
For CGI
X:\path\to\php\php-cgi.exeFor ISAPI
X:\path\to\php\php5isapi.dllThe only other way to map PHP for IIS is using FastCGI, but in most cases you'll be using one of the two above. If you have anything other than exactly what I've listed above (change the path to suite your environment) then PHP will not work.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
C:\path\to\php\php5isapi.dll
Have Done it according to the instructions given above in your list...and have set up the php5isapi.dll
in Home directory -> configuration.... but no web extension is done as mine is iis 5.
I'm running out of ideas.
I'm running out of ideas. The "%1 is not a valid Win32 application." error you are getting indicates several possibilities;
1) There are spaces in the application mapping path.
2) The application mapping extension is different from the actual scripts you are trying to run.E.g, the application mapping is .php3 and the actual scripts are .php.
3) The path to the actual php5isapi is wrong in your application mapping.
Apart from those I'm actually not too sure what else it could be off the top of my head. One question; as your using IIS 5, are you using URLScan or IIS Lockdown at all? If so, is PHP blocked in there at all?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
failed to open stream: No such file or directory in
Hi, i followed your guide and I installed fine (good guide), I can see the phpinfo.
but when i run my proyect i recieved
Warning: include(ayto_gestion/SqlFun.php) [function.include]: failed to open stream: No such file or directory in C:\Archivos de programa\PHP Designer 2005\webs\ayto_gestion\login.php on line 36
Warning: include() [function.include]: Failed opening 'ayto_gestion/SqlFun.php' for inclusion (include_path='.;C:\php5\pear:/docroot') in C:\Archivos de programa\PHP Designer 2005\webs\ayto_gestion\login.php on line 36
Fatal error: Class 'SqlFun' not found in C:\Archivos de programa\PHP Designer 2005\webs\ayto_gestion\login.php on line 37
Obviously i put these files in this direction, but i suppose i have to change anything in the php.ini could you help me?
Glad the guide helped! First
Glad the guide helped! First thing to check will be your NTFS permissions. Ensure you IUSR account has read permissions to all your application directories and files. Using the incude() function will also mean you will need to add the directories which contain the files referenced by your include statement to the "include_path" directive in php.ini.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Hi again;
I set my route in include_pat (C:\Archivos de programa\PHP Designer 2005\webs), and I'm sure that i have permission because i use administrator, but i recieve the same.
I have read that i have to change doc_root and set the path, but it doesn´t work. You can see that it is a page for login, and after this I try to connect to mysql, could it be a problem?
sorry I'm very lost with it.
thank a lot.
You have spaces in your
You have spaces in your path. Did you ensure you enclosed the path with ""? Sp the include_path would look something like;
include_path = "C:\Archivos de programa\PHP Designer 2005\webs"----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
thanks
thanks for your help...
It was bizarre, because I was using php 4, and when i upgrade to 5, the path sttoped working, so i added a "/", it started working again.
bye and good work
First ,thanks for your tutorial,but for connecting to mysql ?
Hi,
Thanks for your help.
I used your guides and i can see information of phpinfo() function in my browser ,but when i want connect to mysql i receive this error :
Fatal error: Call to undefined function mysql_connect()
is there any help?
Thanks
Jamshid
Is the MySQL extension loaded?
When using the phpinfo() function is the MySQL extension loaded?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
PHP IIS W2003 HTTP 500 Internal Server Error on subdirectories
I am getting the
HTTP 500 Internal Server Error
on tested working php scripts
in sub directories only !
They work fine in the root of the website.
PHP Version 5.2.5
Windows 2003 server
IIS
Permissions are the same in the sub directories.
Any ideas?
Cheers
Alex
the page cannot be displayed
Hi,
After I carefully follow your instructions, still the page cannot be displayed. Im running at win xp, iis 5.1 with asp.net 2.0 installed. I try to install PHP 5.2.5
HTTP 403.1 Forbidden: Execute Access Forbidden
Internet Information Services
--------------------------------------------------------------------------------
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
Need your help. Thanks!
Mark
PHP HTTP 500 error
Hi Alex,
Have you had a look through the article I wrote on troubleshooting the PHP HTTP 500 error?
Mark,
Can you look at the "home directory" tab in your IIS admin manager and let me know what your execute permission is set to?
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
prompt issue
Thanks! I had the same problem and it fixed once I did the mapping by the Default Web Site :)
Great guide!!
Great Result
Thanks a lot! I installed PHP successfully but could not get it to recognise MySQL. In desperation I unloaded PHP and reloaded it only to find that IIS didn't pick up the PHP extension. After 3 attempts found your site with the snazzy vbs script and hey presto! Not only does PHP work but it now recognises MySQL.
A little problem, need help
Hi Brashquido,
I like the way you have written this document with every bit of detail. I ran into a little problem, I did everything like you said in your instructions, but instead of extracting the php files on D:\, I used C:\. When I try to go to the command prompt and go to C:\PHP\ and try to run; iisext.vbs /AddFile C:\php\php5isapi.dll 1 PHP5ISAPI 1 "PHP 5 ISAPI", it says its not a recognized internal command, but I put this in the path and also created the variable name and value then I even restarted the IIS (5.1), no luck, am I missing a step.
One more thing I wanted to ask you is when you unzip the PHP files into C:\PHP\ do you go and afterwards change the name of the php.ini-recommended to php.ini, is this true.
Thanks,
Adnan
Hi Adnan, If you're using
Hi Adnan,
If you're using IIS 5 or 5.1 you do not need to run the iisext.vbs command as web service extensions were a new feature brought in with IIS 6. As for your second question, yes, once you have modified the php.ini-recommended file with your settings you will need to rename it php.ini. Hope that helps.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
I figured it out
Hi Brashquido,
Thank you for your prompt reply, but I figured it out. Actually I think your instructions are for Windows 2003 Server and not for Windows XP Pro, I wanted to install it on Windows XP Pro. Thanks a lot. I would however like to ask you if you could also put the instructions for installing php5 on Windows XP Pro, I am not sure if you already have, I haven't had the chance to completely browse through your site. Excellent work though.
Best Regards,
Adnan