您现在的位置是:首页 > 常见错误

李清波 2020-03-05 常见错误 1354 复制当前网址

exec() has been disabled for security reasons

将PHP项目部署到新服务器上的PHP环境时,发生报错:has been disabled for security reasons。

微信截图_20200305183345.png

原因:服务器处于安全考虑,会把一些有安全隐患的内置函数给屏蔽了,比如exec()等。

这个时候,只需要去PHP安装目录找到php.ini,ctrl+F搜索“disable_functions”,找到如下属性配置:

disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen

把对应的函数,比如这次所报错的函数exec删除掉,并保存php.ini文件,重启服务,刷新页面。即可解决报错问题。

文章来源:https://www.liqingbo.com/blog-1671.html

评论