php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11621 PHP crashes while using MSSQL functions
Submitted: 2001-06-22 15:25 UTC Modified: 2002-05-24 20:18 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: tomas dot salamon at signum dot cz Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.0.5 OS: Windows NT, Windows 2000
Private report: No CVE-ID: None
 [2001-06-22 15:25 UTC] tomas dot salamon at signum dot cz
Hi!

I am using PHP application on Windows NT platform and it is very unstable while using MSSQL functions. I have tried all IIS5, IIS4 and Apache for Win32 servers, both CGI/ISAPI versions of PHP.
The best situation is on IIS5/Windows 2000, where application is relatively stable. It is not possible to use persistent connections anyway (I get "500 Internal server error" or "PHP has encountered an Access Violation at 73342FC3" immediately).
There is worse situation on Windows NT, especially on IIS4. There it is not possible to use the application, because PHP returns error messages almost everytime and very often is crushes server, so I get system error message "0x0000005 Access violation..." and it is neccessary to restart the web-server service. There is a bit better situation on Apache, but PHP is also very unstable in both CGI/module versions.

As I checked, the most problems appears in mssql_query function.

I have partially "solved" a problem, when I defined own functions, which open a database connection every time before calling respective function and closes it immediately after executing it. For example:

function unidb_query($query)
{
   $link=@mssql_connect(dbMainName,dbMainUser,dbMainPass);
   @mssql_select_db(dbMainData,$link);
   $result=@mssql_query($query,$link);
   @mssql_close($link);
   return $result;
}

This solution was successful, the number of crushes is much lower, but it is not a good solution at all, because of performance and lucidity reasons.

Crashes are also more frequent, when I get some error or message from SQL server, e.g. constraint conflict, etc.

I think the problem will be something like stack or heap overflow, because problems are "cumulating" - when I don't get a crash after the first error message, I will get it certainly after the second one. When I do not close a database connection after some action (mainly query), it is very probable, I get a crash during next action. Even if I do not use persistent connections, I get a crash, when I send a query in a new page, when there was not closed connection while parsing some page before. Also, when I look in system Task window, memory occupied by Apache or Inetsrv service is growing.

A bug should be in MSSQL library, because, when I am using ODBC library, PHP is more stable (but not absolutely stable), but I cannot use ODBC in my application because of some another reasons.

I have tested it on three computers, the problems were very similar, computers are working well in other tasks.

Regards,

Tomas Salamon
tomas.salamon@signum.cz
Signum CZ s.r.o.
Czech Republic

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-24 20:18 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2004-04-15 01:40 UTC] zeke at mothtamer dot com
I have the same problem when connecting to a remote SQL 
Server database.  I'm running: PHP 4.3.2 / Apache 1.3 on 
Windows 2000 Server

I got past the 500 Internal server errors by making sure 
to close all my connections, but the second msquery call 
fails, every time.  I have to open a new connection for 
each query.
 [2004-04-16 14:46 UTC] zeke at mothtamer dot com
I've just upgraded to 4.3.6 and I'm still getting the 
same errors.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 10:01:26 2024 UTC