I moved this discussion from the WPI forum as it relates to a problem with PHP and FastCGI...
Basically, I have a W2K8R2 server running Drupal (7.8), which utilizes PHP/FastCGI and IIS 7.5. The problem is that any version of PHP over 5.3.6 causes most of my PHP pages in Drupal to return a 500 error, which always results in two things:
2. IIS failed request logging reports that 'The FastCGI process exited unexpectedly'.
The application pool is set to classic mode using the v2.0 .NET framework and I have checked for permission problems using Process Monitor. Both the x86 and x64 VC09 SP1 runtimes are installed. I also have PHP Manager installed but it does not report any
problems, and phpinfo() runs fine.
The most frustrating part about this problem is that I can not get any logging out of PHP itself, despite turning on logging options for PHP and FastCGI. If I stay with version 5.3.6, everything works fine. Unfortunately there is a vulnerability with PHP
prior to 5.3.8, so I am required to get PHP patched or shut down our Drupal development, and I have spent the last two days working on this problemw ith no success.
Thanks for helping out, Martin. I checked the time zone setting both in the php.ini file and on the system, both seem to be okay. Here are all of my FastCGI-related settings in the php.ini file (which were mostly set up by WPI automatically, under [WebPIChanges]):
Ok, I commented those out and re-reviewed the guide you linked for configuring FastCGI in IIS. PHP_FCGI_MAX_REQUESTS and instanceMaxRequests are both set to 10000 and the PHPRC value is set correctly. I could not find any problems with the FastCGI settings
or in PHP Manager.
Prehaps one more thing worth noting... if I comment out php_pdo_sqlsrv.dll and php_sqlsrv.dll in the php.ini file, I get an error message for all PHP pages in Drupal instead of just some of them, though this is to be expected because I'm using an SQL database.
The error is "PHP Fatal error: Undefined class constant 'SQLSRV_ATTR_DIRECT_QUERY' in D:\inetpub\wwwroot\Home\includes\database\sqlsrv\database.inc on line 59". The interesting thing about this, though.. is the fact that it is, at least, actually writing
the error to the error log file. So we know that there should not be a problem with error log, since it will write error events if I 'purposely break things'. I still wish I knew why my original problem with these 500 errors does not write anything in the
log, or why it only effects some PHP pages but not others.
I already have SQL driver for PHP installed and it shows up in phpinfo(). I believe the reason for the error was because I commented out the SQL driver extensions (php_pdo_sqlsrv.dll and php_sqlsrv.dll) but only did so at a test. I was merely trying to prove
that error logging was capable of working by doing this.
I have never had a problem with phpinfo(), though I did as you said and created my own 'test.php' file, and got the same result as I do when I check phpinfo() in PHP Manager. That is to say, there are no problems to report. I always run the iisreset command
after every change I make, and so far I have not found duplicate copies of php-cgi.exe running.
I will try obtaining the latest version of the PHP SQL drivers and reinstalling them though just in case...
Kalio
12 Posts
PHP 5.3.8 Problems
Sep 08, 2011 06:09 PM|LINK
I moved this discussion from the WPI forum as it relates to a problem with PHP and FastCGI...
Basically, I have a W2K8R2 server running Drupal (7.8), which utilizes PHP/FastCGI and IIS 7.5. The problem is that any version of PHP over 5.3.6 causes most of my PHP pages in Drupal to return a 500 error, which always results in two things:
1. The application log reports the following:
Faulting application name: php-cgi.exe, version: 5.3.8.0, time stamp: 0x4e537f4b
Faulting module name: MSVCR90.dll, version: 9.0.30729.4940, time stamp: 0x4ca2ef57
Exception code: 0xc0000005
Fault offset: 0x0003af1c
Faulting process id: 0x5e0
Faulting application start time: 0x01cc6e500c8224e3
Faulting application path: C:\Program Files (x86)\PHP\v5.3\php-cgi.exe
Faulting module path: C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll
Report Id: 4ae1b50f-da43-11e0-bdc3-00155d646402
2. IIS failed request logging reports that 'The FastCGI process exited unexpectedly'.
The application pool is set to classic mode using the v2.0 .NET framework and I have checked for permission problems using Process Monitor. Both the x86 and x64 VC09 SP1 runtimes are installed. I also have PHP Manager installed but it does not report any problems, and phpinfo() runs fine.
The most frustrating part about this problem is that I can not get any logging out of PHP itself, despite turning on logging options for PHP and FastCGI. If I stay with version 5.3.6, everything works fine. Unfortunately there is a vulnerability with PHP prior to 5.3.8, so I am required to get PHP patched or shut down our Drupal development, and I have spent the last two days working on this problemw ith no success.
PHP Drupal
HCamper
8048 Posts
Re: PHP 5.3.8 Problems
Sep 08, 2011 06:43 PM|LINK
Hi,
Thanks for the information and moving the post / thread.
I suggest that you look at the php.ini settings for Time / Zone and error message display.
Guide for Time / Zones http://www.php.net/manual/en/function.date-default-timezone-set.php .
The post install steps for PHP are a problem.
You might check this Forum post http://forums.iis.net/p/1180851/1992846.aspx#1992846 it has the extensions
and much of the current problems covered.
I will help after you check the above items.
Martin
PHP php.ini_config php.ini php-cgi.exe 500 - Internal server error php log errors
Community Member Award 2011
Kalio
12 Posts
Re: PHP 5.3.8 Problems
Sep 08, 2011 07:38 PM|LINK
Thanks for helping out, Martin. I checked the time zone setting both in the php.ini file and on the system, both seem to be okay. Here are all of my FastCGI-related settings in the php.ini file (which were mostly set up by WPI automatically, under [WebPIChanges]):
error_log="C:\Windows\temp\php53_errors.log"
upload_tmp_dir=C:\Windows\temp
session.save_path=C:\Windows\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=1
max_execution_time=300
date.timezone=America/New_York
extension_dir="C:\Program Files (x86)\PHP\v5.3\ext\"
I made sure that paths and permissions are correct.
Kalio
12 Posts
Re: PHP 5.3.8 Problems
Sep 08, 2011 07:55 PM|LINK
Also, as a quick test, I tried using a very minimal php.ini file to see what would happen, but it did not change anything.
[PHP]
log_errors = On
[WebPIChanges]
error_log="C:\Windows\temp\php53_errors.log"
upload_tmp_dir=C:\Windows\temp
session.save_path=C:\Windows\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=1
max_execution_time=300
date.timezone=America/New_York
extension_dir="C:\Program Files (x86)\PHP\v5.3\ext\"
[ExtensionList]
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
extension=php_pdo_sqlsrv.dll
extension=php_sqlsrv.dll
[PHP_WINCACHE]
extension=php_wincache.dll
HCamper
8048 Posts
Re: PHP 5.3.8 Problems
Sep 08, 2011 08:42 PM|LINK
Hi,
That looks ok for php.ini settings.
You can comment out extensions
;extension=php_xmlrpc.dll
;extension=php_exif.dll
;extension=php_imap.dll
for now.
Next step is to make sure PHP Manager
and your FastCGI and Recycling settings match and the Handlers
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/
and that you have a Windows System one or more
EnvironmentVariables name="PHPRC" for the Web Sites and the paths as show in the in the guide.
Martin
Community Member Award 2011
Kalio
12 Posts
Re: PHP 5.3.8 Problems
Sep 09, 2011 01:10 PM|LINK
Ok, I commented those out and re-reviewed the guide you linked for configuring FastCGI in IIS. PHP_FCGI_MAX_REQUESTS and instanceMaxRequests are both set to 10000 and the PHPRC value is set correctly. I could not find any problems with the FastCGI settings or in PHP Manager.
Prehaps one more thing worth noting... if I comment out php_pdo_sqlsrv.dll and php_sqlsrv.dll in the php.ini file, I get an error message for all PHP pages in Drupal instead of just some of them, though this is to be expected because I'm using an SQL database. The error is "PHP Fatal error: Undefined class constant 'SQLSRV_ATTR_DIRECT_QUERY' in D:\inetpub\wwwroot\Home\includes\database\sqlsrv\database.inc on line 59". The interesting thing about this, though.. is the fact that it is, at least, actually writing the error to the error log file. So we know that there should not be a problem with error log, since it will write error events if I 'purposely break things'. I still wish I knew why my original problem with these 500 errors does not write anything in the log, or why it only effects some PHP pages but not others.
Kalio
12 Posts
Re: PHP 5.3.8 Problems
Sep 09, 2011 01:20 PM|LINK
Forgot to add, open_basedir was missing from my php.ini file so I added it with it and set it to the base directory of my website.
HCamper
8048 Posts
Re: PHP 5.3.8 Problems
Sep 09, 2011 02:30 PM|LINK
Hi,
So your getting SQL Driver and extension errors. You updates the open_basedir thats ok.
Could you look at the steps for installing the SQL Server Driver for PHP http://learn.iis.net/page.aspx/699/install-the-sql-server-driver-for-php/
download the latest version from Microsoft Download Center.
Use the guide for the SQL Server Driver for PHP add to php.ini you can have both MySQL Server Extension and SQL Server 2008 in
the php.ini.
After you finish the configuration you need to verify / test that php.exe is operating correct
at the command line. Then verify that php can run in IIS Server using test.php.
Create a test.php at C:\inetpub\wwwroot\test.php with <? phpinfo(); ?> it will be used just for verification
you should move it to some other place later for security and safety.
Start from an Elevated Command prompt > cd C:\inetpub\wwwroot then php /? for help then
run php.exe test.php you should display the php information and there should be no errors.
If there are errors check the php-errors.log and you can post the information in the forum.
If there are no errors then browse to the test.php using a browser for http:// localhost / test.php
which should display the php information as decorated html.
If you get the php information display then php is working.
Sorry if this takes time but each part needs to be verified to to find who or what is failing.
If the tests have worked then use the PHP manager to peform the same verifications.
Note: Each time you run the tests in the IIS Server you should do a restart
you may find that php-cgi.exe is running one or more times in the Task Manager.
Martin
Community Member Award 2011
Kalio
12 Posts
Re: PHP 5.3.8 Problems
Sep 09, 2011 07:37 PM|LINK
I already have SQL driver for PHP installed and it shows up in phpinfo(). I believe the reason for the error was because I commented out the SQL driver extensions (php_pdo_sqlsrv.dll and php_sqlsrv.dll) but only did so at a test. I was merely trying to prove that error logging was capable of working by doing this.
I have never had a problem with phpinfo(), though I did as you said and created my own 'test.php' file, and got the same result as I do when I check phpinfo() in PHP Manager. That is to say, there are no problems to report. I always run the iisreset command after every change I make, and so far I have not found duplicate copies of php-cgi.exe running.
I will try obtaining the latest version of the PHP SQL drivers and reinstalling them though just in case...
HCamper
8048 Posts
Re: PHP 5.3.8 Problems
Sep 11, 2011 12:57 PM|LINK
Hi,
Just in case your still looking http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20098 Microsoft Download Center
for the SQL PHP Drivers 2.0 release. Ok. So the PHP engine is working so far so good.:D.
The remaining steps are with problems related to the the Blog the files folders permissions and the "Application Pool" and if it is used
urlRewrite Rules or files.
Part of the pre-install for most of the Blogs and CMS programs is to check that the "IUSR" "IIS_USRS" have full access
read,execute,list permissions to the folders. In some cases you need to allow some files to have write permissions.
The permissions settings are usually convered in the Blog or CMS install guide.
Check that any required Temp Upload Download folders have been created as part of pre-install and that the IUSR,IIS_USRS
have correct permissions.
Check that the SQL Server ( MySQL Server or SQL 2008 R2 Server)
has a user who has rights to the existing database or the empty database that will be used in the install / setup for the Blog CMS.
Then after verifying the steps above check that the "Application Pool" is set to the correct version of the Dot Net Framework
the Identity and if it is "Classic" or Integrated". The Blog or CMS Install guide usually has information for what is to be set.
You can start with Net 2.0 and "Classic" mode and test if that works.
One of the problems you may be having with the IIS Server is the "Inherit" permissions setting.
If you go to the Security Tab and Advanced section and using Windows Explorer or IIS Manager look at the check box
for "Inherit" Permissions change as needed.
Martin
Community Member Award 2011