CakePHP:尝试使用mssql数据源时出错 [英] CakePHP: error when trying to use mssql datasource
问题描述
这是我第一次将MS sql与cakephp一起使用。通常我使用mysql。我已经编辑了database.php文件:
This is my first time using ms sql with cakephp. Usually I use mysql. I've edited my database.php file:
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mssql',
'persistent' => false,
'host' => 'jura',
'login' => 'sa',
'password' => '********',
'database' => 'clientportal',
'prefix' => '',
);
var $test = array(
'driver' => 'mssql',
'persistent' => false,
'host' => 'jura',
'login' => 'sa',
'password' => '********',
'database' => 'clientportal',
'prefix' => '',
);
}
但是,当我查看索引页面时,出现此错误:
However when I view the index page i get this error:
PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/
Fatal error: Call to undefined function mssql_min_message_severity() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\clientportaladmin\cake\libs\model\datasources\dbo\dbo_mssql.php on line 123
它来自dbo_mssql.php文件中的此构造函数:
It's coming from this constructor in the dbo_mssql.php file:
function __construct($config, $autoConnect = true) {
if ($autoConnect) {
if (!function_exists('mssql_min_message_severity')) {
trigger_error(__("PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/", true), E_USER_WARNING);
}
mssql_min_message_severity(15);
mssql_min_error_severity(2);
}
return parent::__construct($config, $autoConnect);
}
我在ini文件中有mssql扩展名
I have the mssql extension in the php ini file
extension=php_mssql.dll
我已经在设置上广泛使用了mssql数据库和PHP,但是想知道是否因为我的php目录中的ini文件是php.ini文件而被称为php.ini-development和php.ini-production,但实际上我使用了位于C根目录下的php.ini文件:
I've been using mssql databases with PHP on my setup extensively but am wondering if its because the ini file in my php directory are php.ini file is called php.ini-development and php.ini-production but I actually use a php.ini file sitting on the root of C:
以前有人需要处理吗?还是有人知道我需要做什么?
Has anyone had to deal with this before? Or anyone know what I need to do? Using W7 btw.
Jonesy
推荐答案
我正在使用SQLSRV驱动程序和相应的CakePHP dbo_sqlsrv.php数据源。
I am using the SQLSRV drivers and the according dbo_sqlsrv.php datasource for CakePHP.
DATABASE_CONFIG外观如下
the DATABASE_CONFIG the looks like this
var $default = array(
'driver' => 'sqlsrv',
'connect' => 'sqlsrv',
'persistent' => false,
'host' => 'tcp:NAUFRAGADOS',
'login' => 'sa',
'password' => '********',
'database' => 'geotest',
'prefix' => 'cake_',
);
请注意主机定义中的 tcp:。这就是我一直在旅行的过程,直到正确为止
notice the 'tcp:' in the host definition. This was what I was tripping about till I've got it right
这篇关于CakePHP:尝试使用mssql数据源时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!