Debugging PHP and SQL Server

I am working on a script in PHP that needs to get some information from a SQL Server database. However, I am having problems connecting to the database. When I use the mssql_connect () function, it gives me an error and says that it cannot connect to the database. However, this does not provide any basis. Is there a way to find out why it won't connect? There seems to be no mssql_error () function or something like mysql library.

+1


source to share


4 answers


Try using pdo ( http://php.net/pdo ). mssql extension is a mess.

Instead of "it returns" for blank lines. This seems to be a bug in ntwdblib that has never been fixed. When I ran into the problem, I almost lost my mind ...



To connect a client: have you activated tcp / ip on sql server? In MSSQL 2005 Express, it is not activated by default!

+2


source


Have you tried looking in the Windows event log? I'm not sure if there will be enough information there, but it might help.



0


source


I would check your settings for PHP MSSQL extension, once I had protection enabled and needed to access a specific MSSQL server.

0


source


Definitely go for PDO, you will benefit a lot in the long run when you want more options in the future.

0


source







All Articles