Re: MSSQL_CONNECT problem
| From: | Dan Shirah | Date: | Mon, 08 Dec 2008 14:45:32 +0000 |
| Subject: | Re: MSSQL_CONNECT problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284316@lists.php.net to get a copy of this message | ||
>
> 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);