Link to home
Start Free TrialLog in
Avatar of elorc
elorcFlag for United States of America

asked on

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

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. :)
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of elorc

ASKER

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.
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.
Try setting for .php files the isapi file for your version instead of the cgi...
Avatar of elorc

ASKER

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.
Avatar of kadadi_v
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



Avatar of elorc

ASKER

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.