php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15400 Queries Crashing PHP.EXE
Submitted: 2002-02-06 05:50 UTC Modified: 2002-04-02 04:02 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: john_woodhouse at hammond-logistics dot co dot uk Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john_woodhouse at hammond-logistics dot co dot uk
New email:
PHP Version: OS:

 

 [2002-02-06 05:50 UTC] john_woodhouse at hammond-logistics dot co dot uk
Evenin'...

This morning I decided to try PHP for our company web site instead of VBScript.  Imagine my delight to find PHP will handle SQL7 with the minimum of fuss... all it would take was

<?php
$hostname = "[IPADDRESS],[PORT]"; 
$username = "[USER]"; 
$password = "[PWD]"; 
$dbName = "[DATABASENAME]"; 
MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db ( $dbName );
$query = "SELECT * FROM [TABLE]";
mssql_query ($query);
?>

Or even lazier
<?
MSSQL_CONNECT("[IPADDRESS],[PORT]","[USER]","[PWD]");
mssql_select_db ([DATABASENAME]);
mssql_query ("SELECT * FROM [TABLE]");
?>

Brilliant 15 lines of VBScript is 3 lines..

Imagine, then, my chagrin, for when I added the mssql_query(); statement I get a window saying PHP.EXE - Application Error.. The instruction at "0x00" referenced memory at "0x00", The memory could not be "read"...

Is it me???

The setup I used was the windows installer but I put php_mssql.dll into c:\PHP and told the php.ini file where it was.. I also stuck the ntwdblib.dll into c:\windows\system32... Yes I know it should be c:\winnt but I changed it at setup...

AAaaanyway...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 07:35 UTC] sander@php.net
Are you calling mssql_connect() this way or did I misunderstand it?
mssql_connect("[localhost,123]", "[www]", "[secret]");
AFAIK, you should just call
mssql_connect("localhost:123", "www", "secret");

Is that your problem?

Anyway, it SHOULDN'T crash.
 [2002-02-06 09:12 UTC] john_woodhouse at hammond-logistics dot co dot uk
Well it does...

Tried your way MSSQL_CONNECT("HOST:123", "USER", "PWD");

got

Warning: MS SQL: Unable to connect to server: HOST:123 in c:\inetpub\wwwroot\hello.php on line 5

Warning: MS SQL message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in c:\inetpub\wwwroot\hello.php on line 6

Warning: MS SQL: Unable to connect to server: (null) in c:\inetpub\wwwroot\hello.php on line 6

Warning: MS SQL: A link to the server could not be established in c:\inetpub\wwwroot\hello.php on line 6

Warning: MS SQL message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in c:\inetpub\wwwroot\hello.php on line 7

Warning: MS SQL: Unable to connect to server: (null) in c:\inetpub\wwwroot\hello.php on line 7

Warning: MS SQL: A link to the server could not be established in c:\inetpub\wwwroot\hello.php on line 7

Tried MSSQL_CONNECT("HOST,123", "USER", "PWD");

and it crashes... with error stated in first posting
 [2002-02-06 09:19 UTC] john_woodhouse at hammond-logistics dot co dot uk
the [] were just there to denote what I was putting into them
 [2002-03-13 14:14 UTC] nest at rts dot ru
The same problem. Win2K Pro, PHP 4.1.2
===PHP.INI
error_reporting= E_ALL; display all errors, warnings and notices
enable_dl=on
extension_dir=c:\php\extensions
extension=php_mssql.dll
===
<?php
	$h = mssql_connect("nest.rtsnet.ru,1433", "wwwuser", "***");
	mssql_select_db("WebInfo");
	$rs = mssql_query("SELECT * FROM foo");
?>
Running from command line or as CGI results in the fatal application error. Any bug in query string results in normal PHP error message "MS SQL:  Query failed in ....".
ODBC version works ok.
 [2002-03-27 04:53 UTC] phpstuff at aweiler dot com
The crash occurs only if the query returns any records.
The following example crashes on the last query. All others run fine (appropriate access rights assumed ;-)

<?
  mssql_connect()
    or die ("Cannot open mssql\n");
  @mssql_query("DROP DATABASE test");
  mssql_query("CREATE DATABASE test")
    or die ("Cannot create database\n");
  mssql_select_db ("test")
    or die ("Cannot select database\n");
  mssql_query("CREATE TABLE foo (bar int)")
    or die ("Cannot create table\n");
  mssql_query("INSERT INTO foo (bar) VALUES (1)")
    or die ("Cannot insert into table\n");
  $res = mssql_query ("SELECT * FROM foo WHERE bar=2")
    or die ("DB error\n");
  echo "Before crashing query\n";
  $res = mssql_query ("SELECT * FROM foo")
    or die ("DB error\n");
?>

Using NT4 SP5 and tried with both PHP4.1.1 and 4.1.2
 [2002-03-27 06:38 UTC] phpstuff at aweiler dot com
*** SOLVED ***

If the configuration option "mssql.compatability_mode" is missing, then php_mssql fails to initialize the procedure pointer for "get_column_content". Looks like a bug, but can be avoided simply by adding the configuration option:

mssql.compatability_mode = Off

May be it is the best to take php.ini-dist and copy the full [MSSQL] section in your active php.ini.

Cheers,
Adrian
 [2002-04-02 04:02 UTC] john_woodhouse at hammond-logistics dot co dot uk
Excellent.. this works... Thanks Adrian..

Ok you can close this now.. :)
 [2004-03-03 00:20 UTC] sang6iru at yahoo dot com
I have the same problem,...

Warning: MS SQL: Unable to connect to server: LOCAL in E:\Inetpub\wwwroot\dprd\include\koneksi.php on line 20

Warning: MS SQL message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in E:\Inetpub\wwwroot\dprd\include\koneksi.php on line 21

Warning: MS SQL: Unable to connect to server: (null) in E:\Inetpub\wwwroot\dprd\include\koneksi.php on line 21

Warning: MS SQL: A link to the server could not be established in E:\Inetpub\wwwroot\dprd\include\koneksi.php on line 21

>> I've fix some message :
Warning: MS SQL: Unable to connect to server: (sangbiru) in E:\Inetpub\wwwroot\dprd\include\koneksi.php on line 21

by adding "sangbiru" user in > Computer Management > User&Group Management....

but when I try to fix this problem by adding "(null)" user, I get the message above... :( anyone could help me??
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC