WordPress 解决Warning: scandir() has been disabled for …的问题

很多新手安装PHP环境之后,安装Wordpress的时候会出现这个

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/…,或者其它函数,解决办法也是一样的.


WordPress