吉吉于

free

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

最近折腾wp,主题无法编辑,提示错误:

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

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

原因:LNMP 0.9禁用了部分存在危险的PHP函数

LNMP0.9禁用的PHP函数包括:passthru, exec, system, chroot, scandir, 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

解决方法:

编辑PHP配置文件:

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

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

重启PHP生效

/etc/init.d/php-fpm restart

转载请注明:于哲的博客 » 解决Warning: scandir() has been disabled for security reasons in…的问题