Forum Moderators: open

Message Too Old, No Replies

MS SQL problem, cannot connect to localhost

         

BadGoat

5:04 pm on May 13, 2009 (gmt 0)

10+ Year Member



Hi guys,

I have a MSSQL server.. Been working fine for years. Over the last 3 years I'd written a bunch of PHP code to interact with the MSSQL database. The company I worked for shut down, and I got all the servers in lieu of pay, so I have them all set up in my basement now. (I am on a new domain name though using the same computer names, new IP addressing, etc)

The DB connection code used to work just fine on the web server, but it no longer does. so I tried moving the code to the MSSQL server and altering the DB connection lines so it tries to connect to localhost instead, but that fails as well.

I have successfully telnetted to the local IP via port 1433 so I know that it is accepting connections.

The error I get:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost

or

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: sql.domain.com

I have verified that theusername/password I am using to connect is valid in SQL Enterprise Manager.

Here's some info from phpinfo.php:

PHP Version 5.2.9

System Windows NT MOOSE 5.2 build 3790
Build Date Feb 25 2009 15:51:41
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\xampp\php\php.ini
Scan this dir for additional .ini files (none)
additional .ini files parsed (none)
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Debug Build no
Thread Safety enabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, data, http, ftp, compress.zlib, zip
Registered Stream Socket Transports tcp, udp
Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*

I am at a sincere loss, and have no idea what to try. Any guidance is most appreciated. I do not believe it is a php problem (though I very well could be wrong!) My gut says it's a server config issue.

LifeinAsia

5:28 pm on May 13, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



How are you trying to connect? By IP address or host name? Given the "Unable to connect to server: sql.domain.com" error, it sounds like you're trying to connect by domain name.

You'll need to make sure that points to the new domain name and that the domain name resolves to the correct IP address, whether through DNS or your hosts file.

BadGoat

5:40 pm on May 13, 2009 (gmt 0)

10+ Year Member



I have tried connecting via IP address, via localhost, via server name.

Is the DNS or hosts file required for running the script locally on the SQL server?

I will look into those now.

BadGoat

5:56 pm on May 13, 2009 (gmt 0)

10+ Year Member



Oh, I should note that when I moved the scripts to the SQL server, I also installed XAMPP and turned off outside port 80 access to the server.