0

I am trying to connect to Microsoft sqlserver from ubuntu using PHP 7, but i am getting this error,

PHP Fatal error: Uncaught Error: Call to undefined function mssql_connect()

FYI: there is no line called ;extension=php_mssql.dll in php.ini to remove the comment.

Learner
  • 51
  • 1
  • 6
  • Possible duplicate of [PHP 7.0 ODBC-Driver for Windows](http://stackoverflow.com/questions/34200997/php-7-0-odbc-driver-for-windows) – SQLMason Feb 01 '17 at 05:35

2 Answers2

0

you are using linux , so you won't find the line extension=php_mssql.dll

it perhaps be extension=php_mssql.so ,

the php extensions in ubuntu is suffixed by .so

and for connecting to mssql server from php you have to take a look at PDO MSSQL

Example #1 PDO_DBLIB DSN examples

The following examples show a PDO_DBLIB DSN for connecting to Microsoft SQL Server and Sybase databases:

mssql:host=localhost;dbname=testdb

sybase:host=localhost;dbname=testdb

dblib:host=localhost;dbname=testdb

hassan
  • 7,812
  • 2
  • 25
  • 36
0

This is likely the same as PHP7 can't connect to MySQL

PHP7 no longer supports the mysql interfaces. You will need to start using mysqli or PDO

Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32