尝试连接到MS SQL服务器,但它显示错误

$username = "*******";
$password = "*******";
$hostname = "180.179.67.205";
$dbname = "**********";

//connection to the database
$dbcon = mssql_connect($hostname, $username, $password)or die("Unable to connect to MSSQL");

//select the database
mssql_select_db($dbname, $dbcon); 

Call to undefined function mssql_connect()

enable mssql in php.ini

;extension=php_mssql.dll

to

extension=php_mssql.dll

Use this:

$username = "*******";

$password = "*******";

$hostname = "180.179.67.205";

$dbname = "**********";

//connection to the database

$dbcon = mysql_connect($hostname, $username, $password)or die("Unable to connect to MySQL");

//select the database

mysql_select_db($dbname, $dbcon);

// Call to undefined function mysql_connect()

i changed mssql to mysql because it's not supported in new version

OR

I suggest that you comment out the ;php_mssql.dll in the php.ini file and see if the error goes away.

Make sure you have set up a user with "SQL SERVER authentication" who has rights to connect.

and also check

PHPINFO: mssql MSSQL Support enabled