首页 > 技术文章 > HTTP 500报错解决

herui1991 2020-02-02 20:38 原文

今天在用知更鸟主题更新个人网站的时候,每次提交博文,直接报错HTTP 500,回到首页刷新后,博文已经提交上去了,分析nginx日志,没有什么报错,WordPress无法查看日志。

初步判断,应该是PHP调用这块出现了问题,先把日志功能打开。

# 由于php.ini配置文件中错误显示关闭导致,将下值由Off 变更为 On
display_errors = On
display_startup_errors = On

# 重启php服务
[root@localhost ~]# system restart php-fpm 

重新提交,WordPress日志报错如下:

Warning: Invalid argument supplied for foreach() in /home/wwwroot/default/wp-includes/class-wp-theme.php on line 1148
Warning: scandir() has been disabled for security reasons in /home/wwwroot/default/wp-includes/class-wp-theme.php on line 1136

果然,提交的时候,调用了php被禁用的函数,修改php.ini中的配置,删除红色部分,

disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server
# 再次重启php服务即可
[root@localhost ~]# system restart php-fpm 

 

推荐阅读