2013-01-07 3 views
9

karşılaştığım aşağıdaki hata modu ile açılamaz:yakalanmamış istisna 'Zend_Log_Exception' "a"

Benim bootstrap olarak

Uncaught exception 'Zend_Log_Exception' with message file.log cannot be opened with mode "a"

Aşağıdaki kod var:

$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); 

tam hata sayfası:

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

cevap

17

dosya üzerinde sağ izni koyun: 0777. Dizin /home/http/me.tv/fbapps/www/tmp/logs/ varsa

Kontrol, daha sonra terminalde bu komutu çalıştırın:

chmod 777 /home/http/me.tv/fbapps/www/tmp/logs/vengeance.log 
+0

thx – Slrg

+2

Tüm dizinde '755' izinleri vardı ve dosya mevcut değil. Dizinde '777' olan izinlerin değiştirilmesi sorunu çözdü. – Radek

+1

Dosya ve dizin hem de 777 chmod koydum .. PHPUnit sitem aynı hata mesajı veriyor. – Erik

0

web sunucusu kullanıcı günlükleri klasöründe (geçmesine) yazma ve exec hakkına sahip olmalıdır.

chown www-data:www-data -R logs/ # change www-data by the user of the web server chmod 755 -R logs/

bir yerlerde 777 koymak için çok kötü bir fikir. Yardımınız için