Tuesday, November 24, 2009

Correcting PHP 5.3.1 x86 Database Connections in Windows 2008 x64, IIS 7.5, mysql 5.1 x64

Experts Exchange
November 24, 2009 11:49 AM
Solution
Author: heensit Date: 11/23/2009 - 08:28AM CST
Title: php works, connection to mysql via PHP fails
Tags: drupal mysql IIS error 500, php compiling x64
Zones: Drupal, Web-Based CMS, PHP and Databases
Author's Account Type: Premium Service Member
Author's Subject Experience: Unknown
Time Zone: Central European Time (GMT+01:00)
Points: 500
Hi.


I've set up a new windows 2008 R2 standard server and installed PHP 5.3 (x86, but with the visual c++ x64 redistribution pack), mysql 5.1 (x64) and drupal 6.3
PHP seems to work fine as does the IIS 7.5
When I go to the http://drupal.website.be/install i can continue without errors until I reach "Setup Up database".
I created an empty database in Mysql and a user who has total access to that database.
When I fill out everything (database name, database username and database password) and click onto "save and continue"  I'm getting the dreathfull HTTP Error 500.0 - Internal Server Error (The page cannot be displayed because an internal server error has occurred.)


Detailed Error Information
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP_via_FastCGI
Error Code 0x00000000
Requested URL http://drupal.website.be:80/install.php?profile=default&locale=en
Physical Path E:\WWW Data\Witte Duivels Drupal\install.php
Logon Method Anonymous
Logon User Anonymous
Expert Comment
Author: Rsulliv1 Date: 11/23/2009 - 10:26PM CST
Ds you configure mysql for php within iis? Php and iis must be able to communicate with the mysql server


here is a tutorial


http://www.ozzu.com/programming-forum/tutorial-how-install-php-and-mysql-iis-t56303.html
Author Comment
Author: heensit Date: 11/24/2009 - 01:31AM CST
Everything seems to be installed correctly.
I rather think it has to do with the x86 version of php running on a x64 webserver (and the webserver can't be changed to x86 :(
 )
Does anybody has a tutorial on how to compile a x64 version of php? or where we can find the php 5.3 x64 for windows? (it's not the the php site...)
Expert Comment
Author: Rsulliv1 Date: 11/24/2009 - 01:49AM CST
Here's a thread with the x64 php with x64 server. They had the same issue. It appears that the issue was that the wrong driver was being used.


The word is to use the mysql dll client that comes with php, not the one that comes with the mysql client.


Another issue is that you might not have FastCGI enabled on your webserver. Here is a walkthrough that will all you to double check your steps:
http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/


In your phpinfo(), does the "Server API" show FastCGI?




More information on debugging FastCGI:


Here are some troubleshooting steps that I usually do when I run into the problems with PHP/IIS/FastCGI. May be they will help you:


1. If you use IE, disable friendly HTTP error messages in Tools -> Internet Options -> Advanced. That very often allows you to see the actual PHP error.
2. Alternatively, in your php.ini file set error_log = C:\php_errors.log and then after error occured, check if there is anything in the log file.
3. Enable detailed errors in IIS.






Also, this post has a few extra-permissions-related details about solving the FastCGI 500 errors.
http://ruslany.net/2009/06/upgrade-to-wordpress-2-8-and-php-5-3-on-iis-7/




Lastly, for this post, are you using php 5.3.0 VC9 or php 5.3.0 VC6? The following post shows that your error does not occur on VC6.
http://beta-forums-iis-dit.neudesic.com/p/1159786/1912498.aspx


http://beta-forums-iis-dit.neudesic.com/p/1159786/1912498.aspx
Author Comment
Author: heensit Date: 11/24/2009 - 02:38AM CST
Hi,


I'm running fastcGI
(extract of the phpinfo.php)
PHP Version 5.3.1


System  Windows NT HIT07 6.1 build 7600 ((null)) i586
Build Date  Nov 19 2009 09:58:49
Compiler  MSVC9 (Visual C++ 2008)
Architecture  x86
Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--disable-isapi" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/"
Server API  CGI/FastCGI


friendly http error messages are diable, but I kept getting the same error.


after changing the error log, I'm just getting a blank page in IE, no more errors... but it's is also not continuing...


I also tried the VC6 version but then I got this error...
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP_via_FastCGI
Error Code 0x000000ff
Requested URL http://localhost:80/phpinfo.php
Physical Path C:\inetpub\wwwroot\phpinfo.php
Logon Method Anonymous
Logon User Anonymous
Author Comment
Author: heensit Date: 11/24/2009 - 02:39AM CST
more test will be done tonight, now I have to go to customers...
Author Comment
Author: heensit Date: 11/24/2009 - 02:43AM CST
I did however find an error in the eventlogs (after enabling this in the php.ini


Log Name:      Application
Source:        Application Error
Date:          24/11/2009 9:29:17
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      HIT07.heens-it.be
Description:
Faulting application name: php-cgi.exe, version: 5.3.1.0, time stamp: 0x4afc7cc6
Faulting module name: php-cgi.exe, version: 5.3.1.0, time stamp: 0x4afc7cc6
Exception code: 0xc0000005
Fault offset: 0x0000193a
Faulting process id: 0x6f4
Faulting application start time: 0x01ca6ce03625d364
Faulting application path: C:\PHP\php-cgi.exe
Faulting module path: C:\PHP\php-cgi.exe
Report Id: 73f15e40-d8d3-11de-a6f5-000c2936090b
Expert Comment
Author: Rsulliv1 Date: 11/24/2009 - 02:45AM CST
Your output says x86 for arch. Is that referring to the build of php or the os? Are you using a 64-bit anything or is everything 32 bit?
Expert Comment
Author: Rsulliv1 Date: 11/24/2009 - 02:46AM CST
I'll look into the new error message in the morning. Could be a 64/32 bit issue
Author Comment
Author: heensit Date: 11/24/2009 - 05:25AM CST
everything is X64 (the OS, the MySQL, the IIS, ...)
the only thing that is x86 is the PHP (there is no X64 downlaod available on the php site)
Accepted Solution
Author: Rsulliv1 Date: 11/24/2009 - 08:22AM CST
Another option, one that appears to be exactly suited for you, is following this walkthrough, specifically the "Configuring PHP" section:


http://www.thewebhostinghero.com/tutorials/windows2008-iis7-fastcgi-php.html
***********************


Here's a guide to building php 5.2.5 x64


http://www.elxis.org/guides/developers-guides/64bit-apache-php-mysql-windows.html


I would try that out to see if you get any luck with the 64 bit version.


If not this, you can try to downgrade the the previous 32 bit version. It seems that many people are having the same issue, that version of php just might not be compatible with your stack.


***********************
Have you tried to run the php script from the command line? This will rule out the webserver and FastCGI as the root cause.


C:\php\php-cgi.exe <path to your php file>


see if any other errors or warnings appear here.
***********************






Author Comment
Author: heensit Date: 11/24/2009 - 10:54AM CST
When I try to run the php file from the command prompt I'm getting
(....... = path to the file ;-) )


Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_time zone_set() function. In case you used any of those methods and you are still get ting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in .......\testdb.php on line 29


Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not  (trying to connect via tcp://localhost:3306) in .......\testdb.php on line 29


Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_time zone_set() function. In case you used any of those methods and you are still get ting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in .......\testdb.php on line 29


Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.  in .......\testdb.php on line 29


Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '1.0/no DST' instead in .......\testdb.php on line 29


Fatal error: Maximum execution time of 60 seconds exceeded in .......\testdb.php on line 29
Expert Comment
Author: Rsulliv1 Date: 11/24/2009 - 11:38AM CST
Right on! Great Job!

No comments:

Post a Comment