PHP的SQL Server连接错误

问题描述:

我试图使用PHP使用下面的代码连接到SQL Server: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"); 

获得以下错误:

Fatal error: Call to undefined function mssql_connect() in /var/www/echdp/mssql_connection.php on line 26

使用PHP版本

PHP Version 5.3.2-1ubuntu4.2

我有g多次使用它并尝试搜索php_mssql扩展但未找到。还搜索安装mssql扩展,但找不到有用的链接/教程。

如果mssql_connect()不可用,那么听起来好像MSSQL模块没有安装。你可以用phpinfo()函数检查它,它将列出你所有的编译模块。

在Ubuntu,你应该能够从一个包安装模块: -

apt-get install php5-sybase

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

...或为以前的答案状态,与MSSQL标记源编译

你有没有尝试用开关--with-mssql [= DIR]重新编译PHP?

+0

你可以添加更多的细节,如何使用开关。 – Awan 2010-10-11 07:07:05

+0

http://www.web-tech-india.com/articles/php/compiling_php_apache/ – stillstanding 2010-10-11 07:09:21