php 使用 exce不执行与 报错

复制代码
 "Fatal error: Uncaught think\\exception\\ErrorException: error_log(\/www\/wwwroot\/test.limiaokeji.cn\/runtime\/log\/202202\/16_cli.log): failed to open stream: Permission denied in \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/log\/driver\/File.php:169",
        "Stack trace:",
        "#0 [internal function]: think\\Error::appError(2, 'error_log(\/www\/...', '\/www\/wwwroot\/te...', 169, Array)",
        "#1 \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/log\/driver\/File.php(169): error_log('[ 2022-02-16T17...', 3, '\/www\/wwwroot\/te...')",
        "#2 \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/log\/driver\/File.php(75): think\\log\\driver\\File->write('[ 2022-02-16T17...', '\/www\/wwwroot\/te...', false, true)",
        "#3 \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/Log.php(179): think\\log\\driver\\File->save(Array, true)",
        "#4 \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/Error.php(93): think\\Log::save()",
        "#5 [internal function]: think\\Error::appShutdown()",
        "#6 {main}",
        " thrown in \/www\/wwwroot\/test.limiaokeji.cn\/thinkphp\/library\/think\/log\/driver\/File.php on line 169"
复制代码

问题原因:

runtime目录没有给到777权限,日志写入失败导致的报错。

解决办法:

给目录项目的runtime目录777权限即可 

 
 
不执行:
出于安全的原因,服务器是不允许php或者其他语言执行exec命令的,当你有特殊需要php在服务器执行exec命令时,你需要设置两个地方,不然就无法执行成功。

修改php.ini

找到php配置文件php.ini,

在文件里搜索“disable_functions”,找到它后把“exec”、“shell_exec”去掉,然后保存文件。

 
posted @   mingruqi  阅读(571)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示