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,430 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
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…

864 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

25 Experts available now in Live!

Get 1:1 Help Now