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

来源:互联网 发布:mac上的视频编辑软件 编辑:程序博客网 时间:2024/05/01 00:54

转载自:http://www.xker.com/page/e2013/1126/130258.html

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

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/…
或者红色部分为其它函数,解决办法也是一样的。

0 0