IIS 7 and Above
PHP 5.3.8 Problems
Last post Jan 30, 2012 12:13 PM by HCamper
Sep 08, 2011 07:09 PM|Kalio|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: 220.127.116.11, 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.
Sep 08, 2011 07:43 PM|HCamper|LINK
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
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.
500 - Internal server error
php log errors
Sep 08, 2011 08:38 PM|Kalio|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]):
extension_dir="C:\Program Files (x86)\PHP\v5.3\ext\"
I made sure that paths and permissions are correct.
Sep 08, 2011 08:55 PM|Kalio|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.
log_errors = On
extension_dir="C:\Program Files (x86)\PHP\v5.3\ext\"
Sep 08, 2011 09:42 PM|HCamper|LINK
That looks ok for php.ini settings.
You can comment out extensions
Next step is to make sure PHP Manager
and your FastCGI and Recycling settings match and the Handlers
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.
Sep 09, 2011 02:10 PM|Kalio|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.
Sep 09, 2011 02:20 PM|Kalio|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.
Sep 09, 2011 03:30 PM|HCamper|LINK
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
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
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.
Sep 09, 2011 08:37 PM|Kalio|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...
Sep 11, 2011 01:57 PM|HCamper|LINK
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.
Sep 12, 2011 03:42 PM|Kalio|LINK
I installed the SQLSRV drivers for PHP but it looks like they are the same version I already had. It did not make a difference. I am somewhat convinced it may be a problem related to the SQL in some way, as it seems only pages that perform database operations
seem to be the ones generating the 500 error...
I am not sure what you mean by the blog or CMS install guide/program, but I know my application pool settings are correct and I pretty much ruled out file permissions by using the SysInternals process monitor tool. There are no problems with permissions
on the SQL server either.
Again, I feel it's worth noting that if I revert PHP back to 5.3.6, everything works. At this point.. it just doesn't seem like it could be a configuration problem. It really looks like there must be a genuine problem with PHP 5.3.7+ and some combination
of the following:
SQLSRV VC09 driver for PHP 2.0.1
SQLSRV modules for Drupal 7.x-1.1
Windows Server 2008 R2 SP1 64-bit
Microsoft SQL 2008 SP2 64-bit
Is anyone out there using the same combination of software, I wonder?
I think I will try uninstalling everything and rebuilding the Drupal enviroment from scratch to see if I end up with the same problem.
Sep 12, 2011 04:10 PM|HCamper|LINK
Ok, So the SQL PHP Driver is ok.
The pages for database may be the problem agreed and maybe plugins libaries ro others that are part of the directories.
What I suspect is the seperate permissions for Folders File NTFS Systems permissions in the Drupal Site are a problem.
You can check using Windows Explorer and the Security Tab.
If you use IIS Manager then with Content View instead of Features View.
Sorry for the generic reference CMS / Blog Drupal
The Web Platform suggested guide for Drupal
http://learn.iis.net/page.aspx/505/install-drupal-on-iis/ on IIS Server.
Yes This "Again, I feel it's worth noting that if I revert PHP back to 5.3.6" is "everything works". is true.
If you decide to move on or revert:
You should leave the PHP version 5.3.8 install as it it is working.
Since you have the PHP Manager you can switch to the PHP 5.3.6 version as needed.
You could start with a fresh archive or install of the Drupal and see if that works.
Thank you sticking through this it is time consuming and fustrating.:D
Sep 17, 2011 11:32 PM|HCamper|LINK
Have you reverted back
or made progress ?
Sep 26, 2011 03:51 PM|Kalio|LINK
Sorry, I was out for the past week or so. I haven't had a chance to work on this much more since then, but will probably be trying to rebuild everything later this week.
Sep 26, 2011 04:08 PM|HCamper|LINK
No problem @@.
Oct 03, 2011 04:05 PM|xxrsdsdk209|LINK
I've got the same problem, only difference I see is that we are trying to connect to MS SQL 2005 but still getting
Fatal error: Undefined class constant 'SQLSRV_ATTR_DIRECT_QUERY' in E:\inetpub\wwwroot\cprint\dev\includes\database\sqlsrv\database.inc on line 59
Oct 03, 2011 04:43 PM|HCamper|LINK
Hello @ xxrsdsdk209,
Open a new thread your have problems with php code and the SQL PHP Driver.
Oct 04, 2011 12:55 PM|panmanphil|LINK
Oct 04, 2011 04:47 PM|HCamper|LINK
Hi @ panmanphil,
Exact same error post the information.
What version of the Visual Studio run time installer for the "MSVCR90.dll" you have updates and security patches ?
Same Exception code post the information.
Nothing in php-error.log that is good.
You have this " fails with a message about unable to set named parameters" you should check
Brian Swans Blog for use of the PHP Sql Server driver for parameters.
Have you checked the SQL Server PHP driver Forum
Oct 05, 2011 03:13 AM|panmanphil|LINK
Oct 05, 2011 03:43 AM|HCamper|LINK
For the Microsoft Foundation Library errors "MSVCR90.dll, version: 9.0.30729.6161"
visit the Microsoft Download Center and Download the installer(s) for the Visual Studio 2008 runtimes.
Save the files to hard disk add or modify the file name from the download center
VS2008-SPX-vcredist-NN.exe NN being one for X86 and X64 SPX if this is a service pack. You should have at least two packages.
Do not run the Visual Studio 2008 runtime installers online id it asks to repair or remove take the remove option first.
After the Visual Studio 20008 runtime installer has finished run the installer again.
Look at Search (Google or Bing) on the "Faulting module name: MSVCR90.dll, version: 9.0.30729.6161" results.
It would appear that one or more Software Installers can corrupt the MFC C++ libraries.
For the PHP SQL Driver coding use Brian Swans examples and the MSDN Documentation.
A very old is the standard "Hello world"
http://en.wikipedia.org/wiki/Hello_world_program this may seem dumb
seasoned programmers use this method.
For PHP SQL Driver this is "Hello Sql Server" then use the working examples to check your code.
Oct 07, 2011 02:44 AM|panmanphil|LINK
Oct 07, 2011 03:06 AM|HCamper|LINK
Thanks for the update & information :D.
So you and the SQL Server PHP Driver Forums deserve a big cheers :)
So the overlay code by Drupal and PDO is "beating" up the Microsoft driver.
I still would keep a watch on the Visual Studio 2008 runtime installs.
There are alot of conflicts with third party vendors and the runtimes.
Oct 13, 2011 09:22 PM|Kalio|LINK
Thank you so much panmanphil! This did the trick and solved my problems. I never did get a chance to rebuild our whole enviroment from scratch, but thankfully, I won't need to. Thanks again!
In case anyone needs it, here is a direct link to the special patch made for the Drupal SQL driver:
Oct 15, 2011 01:45 AM|HCamper|LINK
The other users in this thread so far have found a solution.:D.
Could you post the PHP code or post the IIS server log errors for failures or success ?
The alternate for IIS 7.0 IIS 7.5 Server is Enable and Turn on "Failed Request Tracing"
You can ( Google or Bing ) for the guides for FRT which should lead the the IIS Net Library.
Could you re-check the "Application Pools" and Permissions for Accounts and users.
Read the IIS Net Library guides:
Nov 22, 2011 04:16 PM|HCamper|LINK
The PHP 5.3.8 thread http://forums.iis.net/p/1182091/1997952.aspx#1997952 special case SQL Driver for PHP.
Update this thread issues related to PHP 5.3.8
Jan 30, 2012 12:13 PM|HCamper|LINK
PHP 5.3.8 Problems and issues get the latest version and release.
http://learn.iis.net/page.aspx/773/how-to-install-the-microsoft-web-platform-for-php/ How-To Install.
http://forums.iis.net/t/1186508.aspx IIS 7 - Forum-FastCGI-PHP -Information.