首页 > 网站服务器 > 正文

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

来源:疯狗科技  2015-09-01  点击:

春哥亲测可用。

安装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()问题
133-4920-4444
  返回首页 回到顶部  

微信

触屏版

电脑版