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,424 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
Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
The viewer will learn how to count occurrences of each item in an array.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now