解决Warning: scandir() has been disabled for security reasons in…的问题

今天改了一下博客主题,结果在编辑主题的时候出现了

Warning: scandir() has been disabled for security reasons in /home/wwwroot/…
Warning: Invalid argument supplied for foreach() in /home/wwwroot/…

错误。开始以为是文件权限问题,检查下来结果发现不是,改了权限没有生效,后来打开探针,发现原来是因为php里面的scandir函数被禁用了。
解决办法:
编辑php.ini,找到这行:

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

去掉scandir保存并重起php-fpm即可。

同样,如果是Warning: exec() has been disabled for security reasons in /home/wwwroot/…
或者红色部分为其它函数,解决办法也是一样的.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据