大家好,我在部署邮件web端的时候,用roundcube连接sqlserver数据库出现下面的错误。
21-Sep-2009 12:00:49] MDB2 Error: not found (-4): [Error message: extension mssql is not compiled into PHP]
好像是mssql需要配置到php中,但我不知道该怎么做。请大家帮忙看看。

解决方案 »

  1.   

    php.ini文件中找到extension=php_mssql.dll去掉前面的;
      

  2.   

    建议使用PDO 进行 MSSQL 的连接.http://cn.php.net/manual/en/ref.pdo-dblib.php#86668
      

  3.   

    下面是我用pdo链接mssql的简单代码:function getResulte($table, $array) {
    $db=connect("mssql","127.0.0.1","rss","sa","123456");
    $result = $db->query ( $table );
    echo gettype($result);
    $output = '<?xml version="1.0" encoding="UTF-8" ?>';
    $output .= '<rss version="2.0">';
    foreach ( $result as $row ) {
    $output.="<huochetou>";
    foreach ( $row as $key => $val ) {
    foreach ( $array as $a ) {
    if ($key === $a) {
    $output .= "<$key>" . $val . "</$key>";
    break;
    }
    }
    }
    $output.="</huochetou>";
    }
    $output .= "</rss>";
    return $output;
    }function connect($type, $host, $dbname, $name, $pwd) {
    //$db = new PDO ( "mssql:host=221.232.160.236;dbname=test", 'kfz', '123456' );
    $db = new PDO("$type:host=$host;dbname=$dbname", $name, $pwd );
    return $db;
    }file_put_contents ( "D:\\rss.xml", getResulte ( "select * from t_channel", array ("shijian","daima","mingcheng" ) ) );?>
      

  4.   

    是不是没有修改环境变量?最近在弄php oracle,环境变量很重要!