Troubleshooting a HTTP 500 error with PHP can be a bit of a can of worms. So much of it depends on things specific to your local environment, such as what Windows operating system you are using, how you have the PHP application mapping configured in IIS, under what security context your IIS application is run and even your php.ini configuration. In this article we'll look at some common causes of what can cause a HTTP 500 error in your PHP environment.
Check you PHP application mapping and ensure that the path to you PHP handler is set correctly. If you are using FastCGI you will also need to check that the correct path is specified in the registry (if using the community version of FastCGI) or in fcgiext.ini (if using MS FastCGI)
Make sure the application mapping extension is the same as the actual scripts you are trying to run. For example the application mapping is .php, make sure you php scripts are using the .php extension.
Try to eliminate any spaces in the directory structure as this can sometimes lead to problems where IIS sees the text prior to the space as the path and the text after the space as an application argument. Also try an avoid situations where there are directory structures sharing naming conventions in part or hole.
If you're using ISAPI are all the PECL extensions you're trying to load multithread safe? The PHP ISAPI module is multithread safe, however it is possible that one of the PECL extensions is not and could be crashing your PHP environment.
If you are getting an error such as "%1 is not a valid Win32 application." and are running a 64-bit version of Windows server, then before you can run PHP you need to enabled 32-bit support using this command;
adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
This is by no means a definitive list, and I plan to add to it as time goes on. Hopefully this article will have given you a few clues what to look for if you are getting a HTTP 500 error in your PHP environment, but if not please feel free to comment below or create a forum thread detailing your problem and I'll do all I can to help solve it.
Bookmark/Search this post with:
Comments
sysinternals.com's filemon
sysinternals.com's filemon really helps divide the problem for further conquerage.
Very true! Filemon is worth
Very true! Filemon is worth its weight in gold.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
550 error IIS Win2003 - sub directories only
Checked everything above.
Then I thought it was stange that my .php script was working in the root.
I then realised that the script has an include file and that was in the root,
so the path to it was incorrect in the sub directory and so the script was not working - giving the 500 error. Once I put the include file in the sub directory it worked fine.
Alex
Nice one Alex, thanks for
Nice one Alex, thanks for posting your solution.
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
still have the same problem..
I am running win2k3 enterprise 64bit edition. I have already run the "adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1" but still get the same error : %1 is not a valid Win32 application while i run PHP file.
That might not be your
That might not be your problem then. Have you checked this KB article out?
http://support.microsoft.com/kb/812486
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
New Server Extensions Web
I created a new Server Extensions Web with IIS over the Default Web SIte, using the same name of my existing virtual directory, NOW PHP scripts run correctly.
Hey can you help me. I am
Hey can you help me. I am still having 500 errors on my simple
<?phpphpinfor();
?>
IIS 6 on win2003 server, with haivng run your IIS -aid, after having tried to install using your install steps. any ideas of what to look for?
I could really use some help as this has been going on for me for 4 days now. I am running out of options, and really need a PHP & mySQL running on IIS platform for so many of the new tool, CMS, wiki, MoveabType, webmail, etc...
Michael L. Gokey
Internet & Information Systems Specialist,
"designing, securing, administering networks, email and Internet systems"
404.545.3481
Hi Michael, Does your php
Hi Michael,
Does your php info file contain phpinfor(); as you stated above? If so, change it to phpinfo(); and then try again.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
php5, mysql5, iis5, win xp, Dreamweaver cs3
Mine is a bit unique. php info comes up fine, timetest.php shows the current time.
My problem is when I try to show localhost/default.php a page with records from mysql that it gives http 500 error on the page and if I go back and remove the dynamic text to show the records it works but obviously without any records.
Confused!