- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我遇到了以下错误:
Uncaught exception 'Zend_Log_Exception' with message file.log cannot be opened with mode "a"
在我的 Bootstrap 中,我有以下代码:
$logfile = PROJECT_PATH . DIRECTORY_SEPARATOR .'/tmp/logs/'.$config->app->logfile.'.log';
if (!file_exists($logfile))
{
$fp = fopen($logfile, 'a');
fclose($fp);
}
$redacteur = new Zend_Log_Writer_Stream($logfile);
$logger = new Zend_Log($redacteur);
完整的错误页面:
Warning: fopen(/home/http/me.tv/fbapps/www//tmp/logs/vengeance.log) [function.fopen]: failed to open stream: No such file or directory in /home/http/me.tv/fbapps/www/inline/bootstrap_vengeance.php on line 81
Warning: fclose() expects parameter 1 to be resource, boolean given in /home/http/me.tv/fbapps/www/inline/bootstrap_vengeance.php on line 82
Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"/home/http/me.tv/fbapps/www//tmp/logs/vengeance.log" cannot be opened with mode "a"' in /home/http/me.tv/fbapps/www/library/Zend/Log/Writer/Stream.php:78 Stack trace: #0 /home/http/me.tv/fbapps/www/inline/bootstrap_vengeance.php(85): Zend_Log_Writer_Stream->__construct('/home/http/medi...') #1 /home/http/me.tv/fbapps/www/htdocs/vengeance/index.php(9): require_once('/home/http/medi...') #2 {main} thrown in /home/http/me.tv/fbapps/www/library/Zend/Log/Writer/Stream.php on line 78
最佳答案
对文件赋予正确的权限:0777
。
检查目录 /home/http/me.tv/fbapps/www/tmp/logs/
是否存在,然后在终端中运行此命令:
chmod 777 /home/http/me.tv/fbapps/www/tmp/logs/vengeance.log
关于php - 未捕获的异常 'Zend_Log_Exception' 消息文件。无法使用模式 "a"打开日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14196352/
我是一名优秀的程序员,十分优秀!