修改:处理tp自动生成的日志文件 访问无权限的问题
This commit is contained in:
parent
4096b9ae36
commit
44db93be7e
|
|
@ -67,7 +67,7 @@ class File implements LogHandlerInterface
|
||||||
$destination = $this->getMasterLogFile();
|
$destination = $this->getMasterLogFile();
|
||||||
|
|
||||||
$path = dirname($destination);
|
$path = dirname($destination);
|
||||||
!is_dir($path) && mkdir($path, 0755, true);
|
!is_dir($path) && mkdir($path, 0755, true) && chmod($path,0777);
|
||||||
|
|
||||||
$info = [];
|
$info = [];
|
||||||
|
|
||||||
|
|
@ -123,7 +123,22 @@ class File implements LogHandlerInterface
|
||||||
|
|
||||||
$message = implode(PHP_EOL, $info) . PHP_EOL;
|
$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用户没有写权限的问题 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue