Bastien - I'm getting desperate,

Yes, I'm using a valid SQL account. I've tried putting both versions of 
"ntwdblib.dll" in the php directory, and the system32 directory (not at once of 
course), and I get the same error.

I've pretty much tried everything I've read....the kicker is I can access the 
SQL Server fine by using ADO in PHP. It's only when I try mssql_connect that 
the connection fails....

The whole reason I don't use ADO is because the queries don't stand up to SQL 
injection...So I wanted to use mssql_connect with "mssql_bind" so I can do 
parameterized queries....

Do you have any other thoughts?

Thanks!


From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 10:02 AM
To: Dan Shirah
Cc: David Stoltz; php-general@lists.php.net
Subject: Re: [PHP] MSSQL_CONNECT problem


On Mon, Dec 8, 2008 at 9:45 AM, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
> Can't seem to connect with MSSQL_CONNECT. The function IS available. I'm
> in a Windows environment, connecting to a SQL 2000 instance. My code:
>
> mssql_connect('INTRA_SQL,1433', 'uname', 'password');
> mssql_select_db('database');
>
> I've tried leaving the port out, tried using server IP address, all to
> no avail. I've copied the "ntwdblib.dll" from my SQL 2000 box to my PHP
> directory on the web server - no go. (this was suggested on the php
> site).
>
> mssql.secure_connection = off (in the php.ini file)
> extension=php_mssql.dll (is also included in the ini file)
>
> Keep getting error message: Unable to connect to server
>
> Does anyone have any ideas?
>
> Thanks!
> Dave

Dave,

For my connection I didn't copy the ntwdblib.dll file from the SQL Server
and paste it onto the PHP server...I believe there was an older version of
the ntwdblib.dll that I had to download...the file had a modification date
of I think 11/2003.

Things to check.

extension=php_mssql.dll uncommented in your PHP.ini

See if your PHP server can talk to your SQL Server.  I would assume they are
both inside the DMZ and that your DNS resolves the server names, correct?

When making your connection try doing it like this:

//Assign the server connection to a variable
$connect = mssql_connect('SERVERNAME, 'USERNAME', 'PASSWORD');

//Select your database and reference the connection
mssql_select_db('DATABASE', $connection);
Have you created a mssql account to allow connetion from whereever you are 
coming from?


-- 

Bastien

Cat, the other other white meat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to