WenRou's Blog

新浪微薄腾讯微薄

最新碎语:测试图片碎语哦

您的位置:WenRou's Blog >lnamp> 解决PHP环境Warning: scandir()问题

解决PHP环境Warning: scandir()问题

安装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禁用了,大家需要的时候去掉就可以了,为了安全尽量少开启!

---

转载请注明本文标题和链接:《解决PHP环境Warning: scandir()问题

发表评论

55 + 2 =
路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交