WenRou's Blog
解决PHP环境Warning: scandir()问题
2015-3-29 温柔哥


安装Wordpress偶尔会出现Warning: scandir()问题,分享一下解决方法:



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

Warning: Invalid argument supplied for foreach() in /home/wwwroot/…



错误。开始以为是文件权限问题,检查下来结果发现不是,改了权限没有生效,后来打开探针,发现原来是因为php里面的scandir函数被禁用了。

解决办法:

打开php.ini(路径:/usr/local/php/etc/php.ini),找到这行:

disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,



proc_get_statu,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,



readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen



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



很多函数问题,都有可能是php禁用了,大家需要的时候去掉就可以了,为了安全尽量少开启!

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容