gpt4 book ai didi

php - 未捕获的异常 'Zend_Log_Exception' 消息文件。无法使用模式 "a"打开日志

转载 作者:IT王子 更新时间:2023-10-29 00:12:31 25 4
gpt4 key购买 nike

我遇到了以下错误:

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com