环境:linux nginx0.76
现象:读取数据库数据显示没问题,db,runtime,assets,cache,log都chown给www(web用户)了。但model一保存就出错。
错误:
CDbException
描述
CDbCommand 无法执行 SQL 语句: SQLSTATE[HY000]: General error: 14 unable to open database file
源文件
/home/www/framework/db/CDbCommand.php(215)
00203: $n=$this->getConnection()->getPdoInstance()->exec($this->getText());
00204:
00205: if($this->_connection->enableProfiling)
00206: Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');
00207:
00208: return $n;
00209: }
00210: catch(Exception $e)
00211: {
00212: if($this->_connection->enableProfiling)
00213: Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');
00214: Yii::log('Error in executing SQL: '.$this->getText().$params,CLogger::LEVEL_ERROR,'system.db.CDbCommand');
00215: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
00216: array('{error}'=>$e->getMessage())));
00217: }
00218: }
00219:
00220: /**
00221: * Executes the SQL statement and returns query result.
00222: * This method is for executing an SQL query that returns result set.
00223: * @return CDbDataReader the reader object for fetching the query result
00224: * @throws CException execution failed
00225: */
00226: public function query()
00227: {
堆栈追踪
#0 /home/www/framework/db/ar/CActiveRecord.php(922): CDbCommand->execute()
#1 /home/www/framework/db/ar/CActiveRecord.php(691): CActiveRecord->insert(NULL)
#2 /home/www/baochehui/protected/controllers/SArticleController.php(77): CActiveRecord->save()
#3 /home/www/framework/web/actions/CInlineAction.php(32): SArticleController->actionCreate()
#4 /home/www/framework/web/CController.php(300): CInlineAction->run()
#5 /home/www/framework/web/filters/CFilterChain.php(129): CController->runAction(Object(CInlineAction))
#6 /home/www/framework/web/filters/CFilter.php(41): CFilterChain->run()
#7 /home/www/framework/web/CController.php(957): CFilter->filter(Object(CFilterChain))
#8 /home/www/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#9 /home/www/framework/web/filters/CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))
#10 /home/www/framework/web/CController.php(283): CFilterChain->run()
#11 /home/www/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#12 /home/www/framework/web/CWebApplication.php(320): CController->run('create')
#13 /home/www/framework/web/CWebApplication.php(120): CWebApplication->runController('sArticle/create...')
#14 /home/www/framework/base/CApplication.php(135): CWebApplication->processRequest()
#15 /home/www/baochehui/index.php(11): CApplication->run()
#16 {main}