#38923 [Com]: ODBC works through command line but not Apache

From: Date: Wed, 05 Mar 2008 16:35:57 +0000
Subject: #38923 [Com]: ODBC works through command line but not Apache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122971@lists.php.net to get a copy of this message
ID: 38923 Comment by: vitner at gmail dot com Reported By: matthew dot berry at wolseley dot co dot uk Status: No Feedback Bug Type: ODBC related Operating System: Unix PHP Version: 5.1.6 New Comment: This problem also occurs under Windows XP Professional with PHP version 5.2.3 and Apache version 2.2.4. The DSN references a SQL Server database on a remote machine, and the PHP program works from the command line but reports an error in the connection when executing through Apache. The following will generate the message "Error in connection" when viewed as a web page. <html> <body> <?php $dsn = "myDSN"; $user = "username"; $upasswd = "password"; $conn = odbc_connect($dsn, $user, $upasswd); echo "Connecting to database '$dsn'...<BR>"; if (!$conn) { echo "Error in connection<BR>"; exit; } ?> </body> </html> Previous Comments: ------------------------------------------------------------------------ [2007-08-01 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-07-24 15:33:01] jani@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2006-09-26 10:31:51] matthew dot berry at wolseley dot co dot uk Thought I should just mention that there is no delay in processing the page through apache. The page is returned within a couple of seconds (roughly the same length of time taken via cli), almost as if the connection is dropped immediately (which is not the case as phpinfo still shows one active connection in odbc at the end of the page). This is a very irritating problem as we are so desperately close to resolving this issue. ------------------------------------------------------------------------ [2006-09-25 08:06:08] matthew dot berry at wolseley dot co dot uk Settings for Apache are Timeout 60 KeepAlive On MaxKeepAliveRequests 200 KeepAliveTimeout 15 StartServers 40 ThreadLimit 75 MinSpareThreads 32 MaxSpareThreads 64 MaxClients 300 ThreadsPerChild 75 MaxRequestsPerChild 10000 Php.ini are: max_execution_time = 30 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) As stated earlier, the command line returns back and displays row data in under 2 seconds, but when running through the Apache server, the code fails to execute. What would cause this difference? ------------------------------------------------------------------------ [2006-09-22 15:57:49] kalowsky@php.net The warning you're seeing (08S01) is telling you that something happened with the connection and it was lost. Check your timeouts and query length to ensure that neither of these is killing the connection. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/38923 -- Edit this bug report at http://bugs.php.net/?id=38923&edit=1

« previous php.bugs (#122971) next »