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”去掉,然后保存文件。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库