Bug #11621: PHP crashes while using MSSQL functions
| From: | tomas dot salamon at signum dot cz | Date: | Fri, 22 Jun 2001 19:25:19 +0000 |
| Subject: | Bug #11621: PHP crashes while using MSSQL functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57695@lists.php.net to get a copy of this message | ||
From: tomas.salamon@signum.cz
Operating system: Windows NT, Windows 2000
PHP version: 4.0.5
PHP Bug Type: Reproducible crash
Bug description: PHP crashes while using MSSQL functions
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
--
Edit Bug report at: http://bugs.php.net/?id=11621&edit=1