Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Zend Db SQLITE设置_Php_Zend Framework_Sqlite - Fatal编程技术网

Php Zend Db SQLITE设置

Php Zend Db SQLITE设置,php,zend-framework,sqlite,Php,Zend Framework,Sqlite,我试图将sqlite设置为辅助适配器,但遇到了问题 我得到以下信息: Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'reports.reports' doesn't exist 我的表格代码是: class Table_Reports extends Zend_Db_Table_Abstract { protected $_name = 'reports'; protected $_id = 'repor

我试图将sqlite设置为辅助适配器,但遇到了问题

我得到以下信息:

Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'reports.reports' doesn't exist
我的表格代码是:

class Table_Reports extends Zend_Db_Table_Abstract {
protected $_name = 'reports';
protected $_id = 'report_id';
protected $_rowClass = 'Model_Report';
protected $_adapter = 'dbReports';
protected $_schema = 'reports';
}

如果我将$\u模式更改为空,那么它将尝试使用我的主mysql数据库

我的应用程序配置是:

resources.multidb.db1.adapter = "PDO_MYSQL"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.dbname = "test"
resources.multidb.db1.username = "root"
resources.multidb.db1.password = ""
resources.multidb.db1.isDefaultTableAdapter = true

resources.multidb.db2.adapter = "PDO_SQLITE"
resources.multidb.db2.dbname = ROOT "/data/reports.db"
有人知道发生了什么吗

谢谢

我已经打开了评测功能,但据我所知,由于运行时出现错误,没有查询任何内容:

$reports = new Table_Reports();
$reportRow = $reports->createRow();

尝试使用应用程序路径和相对路径代替根。可能您有OpenBaseDir限制或授权问题

我已设法解决此问题

适配器使用mysql用户和密码详细信息尝试连接到sqlite,因此我不得不强制适配器进行如下更改:

public function __construct($config = array())
{
    $this->_setAdapter(Zend_Registry::get('dbReports'));
    parent::__construct($config);
}
这在文件
类表\u Reports

中,请尝试,这将使您能够获得实际执行的SQL。从这一点,我们可以确定到底出了什么问题。我将推测,
altertable
正在运行,而它不应该运行。