cli 日志 先行写入 导致 www后续根本写不进去 直接出错。 没有目录权限 没有写入权限
先附上错误信息
thrown in /usr/local/nginx/html/diaodu/thinkphp/library/think/log/driver/File.php on line 245" while reading response header from upstream, client: 192.168.0.110, server: 127.0.0.1, request: "OPTIONS /api/chat_api/upload HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.10.100:8181", referrer: "https://192.168.10.100/"
2021/02/20 17:55:01 [error] 3952#0: *31 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught think\exception\ErrorException: Undefined index: timestamp in /usr/local/nginx/html/diaodu/thinkphp/library/think/log/driver/File.php:245
Stack trace:
修改方案 百度的 - -
首先按找到thinkphp/library/log/driver/file.php
!is_dir($path) && mkdir($path, 0755, true);
修改为
!is_dir($path) && mkdir($path, 0755, true) && chmod($path,0777);
return error_log($message, 3, $destination);
修改为
if (!is_file($destination)) {
$first = true;
}
$ret = error_log($message, 3, $destination);
try {
if (isset($first) && is_file($destination)) {
chmod($destination, 0777);
unset($first);
}
} catch (\Exception $e) {
}
return $ret;