php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45219 mssql_connect() fails to connect to server
Submitted: 2008-06-09 16:51 UTC Modified: 2008-06-09 18:09 UTC
From: dhf2 at buffalo dot edu Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.6 OS: Linux/Windows XP Pro
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dhf2 at buffalo dot edu
New email:
PHP Version: OS:

 

 [2008-06-09 16:51 UTC] dhf2 at buffalo dot edu
Description:
------------
I've been having some issues with mssql_connect. I'm trying to connect to an MS-SQL 2000 database from PHP on a Linux server running PHP 5.1.6, but the mssql_connect() function always gives me the same error message saying it can't connect to the server.

I also tried connecting to the same server from my local machine (Windows XP Pro, PHP 5.2.5) with the same results. However, I wrote a quick python script using pymssql and that worked fine from this machine. I also set up an ODBC connection on this machine and connected from PHP via odbc_connect(), which also worked fine. The mssql_connect() problems are the same whether mssql.secure_connection is set to Off or On in the php.ini

Reproduce code:
---------------
$db = mssql_connect('hostname', 'username', 'password');

if(!$db) {
    die('<h2>Massive failure</h2>');
}

Expected result:
----------------
Should connect to database not print any errors

Actual result:
--------------
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: host.name.of.server in /var/www/html/filename.php on line 28



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-09 17:18 UTC] fmk@php.net
The first parameter should not be a host name but the name of the configuration form the freetds.conf file. Did you configure this?
 [2008-06-09 17:49 UTC] dhf2 at buffalo dot edu
No, I guess I misread the documentation for mssql_connect...

I'll look into that, thanks a lot.
 [2008-06-09 18:09 UTC] dhf2 at buffalo dot edu
Yeah, that completely fixed it. Thanks again, and sorry about the bogus bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 16:01:26 2024 UTC