ID: 45219 Updated by: [EMAIL PROTECTED] Reported By: dhf2 at buffalo dot edu Status: Open Bug Type: MSSQL related Operating System: Linux/Windows XP Pro PHP Version: 5.2.6 New Comment:
The first parameter should not be a host name but the name of the configuration form the freetds.conf file. Did you configure this? Previous Comments: ------------------------------------------------------------------------ [2008-06-09 16:51:34] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45219&edit=1