Page 1 of 1

mssql dll refuses to work

Posted: Thu Mar 23, 2006 6:58 am
by webafrica
Hi Guys,

Really need some guidance here from php gurus - we have exhausted all possibilities.

Just installed php 4.4.2 and php 5.1.2 on a new server and neither will work with mssql dll, however the dll is correctly loaded:
mssql
MSSQL Support enabled
Active Persistent Links 0
Active Links 0
Library version 7.0

When I run test scripts eg: $db = mssql_connect("sql.domain.com","dbuser","dbpass") or die("Unable to connect to server");

It simply returns "Unable to connect to server".

The database details are definitely correct, and the server is able to reach the mssql server.

Can anyone offer any advice?

Posted: Thu Mar 23, 2006 7:15 am
by Chris Corbyn
If you're getting that error the dll is fine ;)

Sounds more like a network/password issue.

Firewall? Remote access rights? ;)

Posted: Thu Mar 23, 2006 3:59 pm
by webafrica
I know - its bizarre, the dll appears to be loaded fine, its just not working "properly".

I can telnet to the sql server no problem from the web server (even tried turning off the firewall to make 100% sure). And tried different user/pass's numerous times, with no luck...

Isnt there perhaps some php debugging function that could assist me here? Otherwise I think its maybe time to break out packetyzer...

Posted: Thu Mar 23, 2006 4:05 pm
by Chris Corbyn
webafrica wrote:Isnt there perhaps some php debugging function that could assist me here? Otherwise I think its maybe time to break out packetyzer...
Just setting error reporting to E_ALL and display_errors to On.

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', 'On');
You might also want to look at debug_backtrace() for general debugging but I'm not sure it'll be of much use here.

Posted: Thu Mar 23, 2006 5:27 pm
by Benjamin

Code: Select all

$db = mssql_connect("sql.domain.com","dbuser","dbpass") or echo msql_error();

Posted: Thu Mar 23, 2006 5:58 pm
by feyd
msql != mssql agtlewis ;)

Posted: Thu Mar 23, 2006 6:10 pm
by Benjamin
Ack I'm missing an s...

Maybe mssql_get_last_message(); will work. Leave it to Microsoft to not return errors.

Posted: Fri Mar 24, 2006 4:47 am
by webafrica
Ok, Im stumped.

mssql_get_last_message(); just outputs "cannot connect to server", however in ethereal no packets are being sent whatsoever :roll: ?

The process php-cgi.exe isnt being blocked on a process level because php_mysql.dll is cool - can connect no problem to mysql databases and the packets are being sent accordingly.

We tried turning off firewalls and made sure there are no files that can't be accessed using Filemon, but everything is fine.

I even installed port tunnel and setup so "localhost" routes to the sql server, but nothing - mssql_get_last_message(); just outputs "cannot connect to localhost". It is definitely working because we can telnet to localhost on 1433.

My only conclusion is either php_mssql.dll is;
a) being blocked from network access (unlikely as I have checked the server thoroughly)
b) buggy (again unlikely though as I have tried different versions)

I am pulling out hair here - any idea's?

Posted: Fri Mar 24, 2006 5:40 am
by webafrica
Just had a premanition - could be malware/spyware....