mssql_connect not working

Do you have questions regarding other database enginges (not MySQL) -- ask here!

Moderators: egami, macek, gesf

Post Reply
landi
php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Fri Feb 12, 2016 4:47 pm

Hi,
Sound likes there is no driver loaded. I'm not familiar with the requirements of mssql, but a quick google shows that you might want to be using the newer sqlsrv_xxx function (e.g. sqlsrv_connect instead of mssql_connect).

If you are getting 'undefined function' then you haven't got that extension loaded. I suggest you check what drivers / extensions you HAVE got loaded. Do a simple page with just a phpinfo() call - it will print out lots of stuff about your php environment. If there is no mention of anything Sql-Server, then you haven't got any SqlServer stuff.

Code: Select all

<?php
phpinfo();
?>
Once the undefined function bit dissapears, the real problem is usually getting the right connection string.
-A

landi
php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Sat Feb 13, 2016 6:58 am

phpcrazyfan wrote: extension=php_sqlsrv_56_ts.dll
So, have I been attempting the wrong command this whole time?
Yes. Notice how the phrase 'sqlsrv' relates the extention name 'php_sqlsrv_56_ts.dll' to the function call prefix for 'sqlsrv_connect'. This is quite common in php.
phpcrazyfan wrote: This extension requires the Microsoft ODBC Driver 11 for SQL Server.
I've not used the sql server drivers, but it is not surprising that MS wants to use ODBC, so if that's what it takes, load it...
phpcrazyfan wrote: sqlsrv support enabled
This is the phrase you are looking for that tells you that the extention you loaded with 'extention=xxx' is, in fact, loaded.
phpcrazyfan wrote: From these 4 options, which one should I use?
SQLSRV32.EXE
The numbers are version numbers, so 32 is version 3.2 and hence the highest version of the list you gave.
- A

Post Reply