Solved

PHP 5.3.5 installation on IIS7 (Win Web Server 2008 R2) generating 500 Internal Server Errors

Posted on 2011-03-16
7
1,443 Views
Last Modified: 2013-12-13
I'm trying to install PHP 5.3.5 on Windows Web Server 2008 R2. I've installed PHP plenty of times in the past and never had an issue with it, but this is my first time installing it on a Windows 2008 system. When my first attempt failed (I kept getting a 500 Internal Server Error on a PHP file that just contained <?php phpinfo(); ?>), I reverted the machine back to its post-OS-install state and tried again by following the instructions at http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/ and http://www.php.net/manual/en/install.windows.iis7.php

Same problem. After completing the installation process as described on these pages, the phpinfo() file that I attempt to open in my browser throws a 500 Internal Server Error. If I test it from the command-line by running php-cgi.exe on my test PHP file, it works fine there. Also, if I just test a file that contains an echo statement in it, that works in the browser without generating a 500 error. Why the hell would phpinfo() be causing a 500 error?

I took it a step further and dumped the result into an HTML file:

php-cgi.exe c:\inetpub\webpublic\phpi.php > c:\inetpub\webpublic\phpi.html

It just generates a warning:

PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone setting
s. You are *required* to use the date.timezone setting or the date_default_timez
one_set() function. In case you used any of those methods and you are still gett
ing this warning, you most likely misspelled the timezone identifier. We selecte
d 'America/New_York' for '-4.0/DST' instead in C:\inetpub\webpublic\pi.php o
n line 2

Other than that, the generated HTML file is fine.

I'm using the non thread-safe version of 5.3.5:

C:\PHP>php -v
PHP 5.3.5 (cli) (built: Jan  5 2011 20:36:18)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Any ideas? I'm about to kick this server through a wall. :)
0
Comment
Question by:elorc
7 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 35151300
Strange, but it may be because the phpinfo function takes much parameters to display and most of them are just outputs of various functions - in this case it may be the timezone as the warning indicates. I'm not sure about IIS, but try to set the default timezone to UTC in php.ini file.
0
 
LVL 1

Author Comment

by:elorc
ID: 35151349
Huh, that fixed it. Why would a warning cause a 500 error like that? I'm trying to think of other warnings I can deliberately cause to see if they show the same behavior.
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 35151763
It is so much more for IIS than PHP - just a server's uhm... "issue" (?)
I guess I cannot force you to install Apache ;) but at least you could just give it a try as it is a slightly more user friendly to debug server errors...

Of course you can't predict anything regarding IIS, but all this should be more than just seeing 500 (or any other SERVER error code) and nothing more.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 6

Expert Comment

by:ramelong
ID: 35162648
Try setting for .php files the isapi file for your version instead of the cgi...
0
 
LVL 1

Author Comment

by:elorc
ID: 35201706
Ramelong: Which file should I use? Is it just php5.dll? It's been a while but I thought the file I needed to use is php5isapi.dll, which isn't included in the package I downloaded from php.net.
0
 
LVL 17

Expert Comment

by:kadadi_v
ID: 35340533
In IIS Is any application Pool Selection Problem....?

Also Can You please go-through this URL:

http://www.thewebhostinghero.com/tutorials/install-iis7-php5-mysql5-win2008server-pt2.html

Regards,
vijay kadadi



0
 
LVL 1

Author Comment

by:elorc
ID: 35369680
I think this is squared away at this point. The only thing that I really have to deal with now (that I'm aware of) is that I'm going to have to rewrite the PHP scripts I maintain so that they're compatible with the Microsoft PHP library, since the old php_mssql isn't supported anymore.

Thanks everyone.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question