解决Warning: scandir() has been disabled for security reasons in…的问题

最近在一台vps上新安装了lnmp,之后在登陆wordpress后台的时候会提示 Warning: scandir() has been disabled for security reasons in /home/wwwroot/yourdomain.com/wp-includes/class-wp-theme.php on line 978 Warning: Invalid argument supplied for foreach() in /home/wwwroot/yourdomain.com/wp-includes/class-wp-theme.php on line 981 诸如此类。除了影响后台美观之外,还无法在线修改模版,所以干脆去修改一下php.ini,不禁用scandir即可。 编辑PHP配置文件:

vi /usr/local/php/etc/php.ini


寻找disable_functions字符串,将后面的scandir删除(提示:vi下可输入/,进入搜索模式) 重启PHP

/etc/init.d/php-fpm restart