CakePHP 2.x MSSQL 2008 Connect

时间:2013-04-17 14:23:58

标签: php sql-server cakephp

我的Windows机器上有CakePHP 2.x和PHP 5.4.3(Windows 8,使用WAMP)。我必须在其他mssql服务器上连接,因为我需要一些数据。我已经尝试了很多方法来连接但是 错误消息始终相同:

Error: A Database connection using "Sqlserver" was missing or unable to connect. 
The database server returned this error: Selected driver is not enabled

Error: Sqlserver driver is NOT enabled

我的database.php配置:

public $urniki = array(
    'datasource' => 'Database/Sqlserver',
    'persistent' => false,
    'host' => 'somehost.com',
    'login' => 'user',
    'password' => 'pass',
    'database' => 'db',
    'prefix' => '',
    'encoding' => 'utf8',
);

知道如何连接它?

1 个答案:

答案 0 :(得分:3)

确保已安装PHP的SQL Server驱动程序,此行在您的php.ini

Extension=php_sqlsrv.dll

详情请见http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-the-sql-server-driver-for-php