diff --git a/vendor/topthink/framework/src/think/log/driver/File.php b/vendor/topthink/framework/src/think/log/driver/File.php index e5682fc..e51df92 100644 --- a/vendor/topthink/framework/src/think/log/driver/File.php +++ b/vendor/topthink/framework/src/think/log/driver/File.php @@ -67,7 +67,7 @@ class File implements LogHandlerInterface $destination = $this->getMasterLogFile(); $path = dirname($destination); - !is_dir($path) && mkdir($path, 0755, true); + !is_dir($path) && mkdir($path, 0755, true) && chmod($path,0777); $info = []; @@ -123,7 +123,22 @@ class File implements LogHandlerInterface $message = implode(PHP_EOL, $info) . PHP_EOL; - return error_log($message, 3, $destination); + // return error_log($message, 3, $destination); + /** 解决root生成的文件,www用户没有写权限的问题 */ + 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; + /** 解决root生成的文件,www用户没有写权限的问题 */ } /**