春哥親測可用。
安裝Wordpress偶爾會(huì )出現Warning: scandir()問(wèn)題,分享一下解決方法:
Warning: scandir() has been disabled for security reasons in /home/wwwroot/…
Warning: Invalid argument supplied for foreach() in /home/wwwroot/…
錯誤。開(kāi)始以為是文件權限問(wèn)題,檢查下來(lái)結果發(fā)現不是,改了權限沒(méi)有生效,后來(lái)打開(kāi)探針,發(fā)現原來(lái)是因為php里面的scandir函數被禁用了。
解決辦法:
打開(kāi)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即可。
很多函數問(wèn)題,都有可能是php禁用了,大家需要的時(shí)候去掉就可以了,為了安全盡量少開(kāi)啟!