thinkphp5日志文件权限的问题

2019-12-24  本文已影响0人  黄刚刚

修改\thinkphp\library\think\log\driver\File.php文件write方法148行:

        //return error_log($message, 3, $destination);

        /** 解决root生成的文件,www用户没有写权限的问题 START*/

        if (!is_file($destination)) {

            $first = true;

        }

            $ret = error_log($message, 3, $destination);

        try {

            if (isset($first)&& is_file($destination)) {

            chown($destination, 'www');

                unset($first);

            }

    }catch (\Exception $e) { }

    return $ret;

    /** 解决root生成的文件,www用户没有写权限的问题 END*/

上一篇下一篇

猜你喜欢

热点阅读