PHP MSSQL Connect Not Working

  • devilwood
  • Silver Member
  • Silver Member
  • User avatar
  • Posts: 436

Post 3+ Months Ago

I have Lighttpd running on my personal windows 7 computer that I use for testing and development. I have a windows VPS that has SQL Server 2008 that I need to connect to. I've already opened port 1433 to my IP and it seems I telnet into it just fine as my CMD prompt just goes blank and then comes back after a couple minutes.

On Win 7 Client running Lighttpd:

1. I've enabled php_mssql.dll in php.ini
2. I've added php_sqlsrv_52_ts_vc6.dll to my ext/ and to php.ini that I downloaded from MS.

But,
I still can't connect. I get just the general Unable to Connect to server warning. I can connect to MySQL on port 3306 so with MSSQL it's some type of configuration.

a.) my server name - with MySQL I just need the IP and it autoresolves the port, but with MSSQL I've tried IP, IP\Computername, IP:port, IP\Computername:port, IP\Computername,port , and IP,port. What would be the correct servername I should use?
b.) I've also created a db user in Plesk. When connecting remotely do I have to use "sa"?

Lastly, is there something I'm missing or more I can try on my client/server setup?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • devilwood
  • Silver Member
  • Silver Member
  • User avatar
  • Posts: 436

Post 3+ Months Ago

After 2 days, I finally made the connection.

1. The servername only needed the ip address, port resolved automatically.

2. I had to install Microsoft SQL Server Client Tools. I chose 2008 packages cause I'm connecting to 2008. This can be downloaded standalone using the feature pack url. The client tools are required. I just went ahead and installed the full version with the SDK as if I was running Management Studio. The SQL driver for PHP is also listed on that page which gives you the ext/ dlls for php, but I already had those installed. Those will need to be downloaded and the correct .dll will need to be copied to your ext/ folder and added to your modules in php.ini. You will also need php_mssql.dll in your ext/ folder and activate it in your php.ini.

3. I then had to log onto my server and located my ntwdblib.dll file. It was actually in the WINDOWS\SysWOW64 folder on my Win2003. I made a copy and emailed it to myself.

4. On my Win7 client that's running lighttpd and php I copied the ntwdblib.dll I emailed myself to the WLMP\PHP\ folder overwriting the existing one that came with the Lighty installation. (I made a backup of the current one before overwriting). I also copied the ntwdblib.dll file to the WINDOWS\SYSTEM32 folder.

5. Double checked that the firewall on the server had port 1433 opened to me. I had some networking buddies tell me to open 1434 monitoring port too just in case, but is probably not necessary.


Connected on the first try. Hope this helps.
  • devilwood
  • Silver Member
  • Silver Member
  • User avatar
  • Posts: 436

Post 3+ Months Ago

2008 SQL Server Feature Pack URL

http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 151 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.