php 5.3 配置mssql笔记

参考URL  https://docs.moodle.org/29/en/Installing_MSSQL_for_PHP#Using_FreeTDS_on_Debian_Lenny

第一步,下载相应的dll

PHP version Thread Safe FreeTDS version Download URL
PHP 5.2.x (vc6) Yes 0.82 + 20090302 patches Download!
No 0.82 + 20090302 patches Download!
PHP 5.3.x (vc6) Yes 0.82 + 20090904 patches (unconfirmed) Download!
No 0.82 + 20090904 patches (unconfirmed) Download!
PHP 5.3.x (vc9) Yes 0.82 + 20090904 patches Download!
No 0.82 + 20090904 patches Download!

第二步,在php.ini中增加extension=php_dblib.dll

第三步,重启IIS

示例代码,测试一下连接是否正常

<?php

    $link = mssql_connect('localhost', 'db_user', 'db_password');

    if(!$link) {

        echo'Could not connect';

        die('Could not connect: ' . mssql_error());

    }

    echo'Successful connection';

    mssql_close($link);

?>

 

你可能感兴趣的:(MSSQL)