Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP SQL Server连接错误_Php_Sql Server_Connection - Fatal编程技术网

PHP SQL Server连接错误

PHP SQL Server连接错误,php,sql-server,connection,Php,Sql Server,Connection,我正在尝试使用以下代码使用php连接到sql server: $myServer = "server"; $myUser = "username"; $myPass = "password"; $myDB = "test"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServe

我正在尝试使用以下代码使用php连接到sql server:

$myServer = "server";
$myUser = "username";
$myPass = "password";
$myDB = "test";

//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer");
获取以下错误:

致命错误:调用undefined 中的函数mssql_connect() /var/www/echdp/mssql_connection.php 第26行

使用php版本

PHP版本5.3.2-1ubuntu4.2


我在谷歌上搜索了很多次,也尝试搜索php_mssql扩展,但没有找到。还可以搜索安装mssql扩展,但找不到有用的链接/教程。

您是否尝试过使用开关重新编译PHP——使用mssql[=DIR]?

如果mssql\u connect()不可用,则听起来好像没有安装mssql模块。您可以使用phpinfo()函数检查这一点,该函数将列出所有已编译的模块

在Ubuntu上,您应该能够从软件包中安装模块:-

apt get安装php5 sybase

(这是php5的Sybase/MSSQL服务器模块)


…或者如前面的回答所述,使用MSSQL标志从源代码编译

您可以添加一些关于如何使用开关的详细信息。