首页 > 解决方案 > Wordpress - 标题后的部分不会加载

问题描述

这是我正在开发的网站:http ://eleganceist.com

但不幸的是,head 之后的部分不会加载。错误日志充满了这个:

[Fri Sep 28 12:37:48 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.cgi
[Fri Sep 28 12:37:48 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.pl
[Fri Sep 28 12:37:51 2018] [warn] [client 46.196.24.141] mod_fcgid: stderr: PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /var/www/vhosts/eleganceist.com/httpdocs/wp-includes/shortcodes.php on line 319
[Fri Sep 28 12:45:52 2018] [error] [client 185.220.101.20] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.cgi
[Fri Sep 28 12:45:52 2018] [error] [client 185.220.101.20] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.pl
[Fri Sep 28 12:45:56 2018] [warn] [client 185.220.101.20] mod_fcgid: stderr: PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /var/www/vhosts/eleganceist.com/httpdocs/wp-includes/shortcodes.php on line 319
[Fri Sep 28 12:49:14 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.cgi
[Fri Sep 28 12:49:14 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.pl
[Fri Sep 28 12:49:17 2018] [warn] [client 46.196.24.141] mod_fcgid: stderr: PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /var/www/vhosts/eleganceist.com/httpdocs/wp-includes/shortcodes.php on line 319
[Fri Sep 28 12:49:17 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.cgi
[Fri Sep 28 12:49:17 2018] [error] [client 46.196.24.141] client denied by server configuration: /var/www/vhosts/eleganceist.com/httpdocs/index.pl

有人知道如何解决这个问题吗?

谢谢

标签: phpwordpress

解决方案


错误后您看不到任何内容的原因很可能是由于您在日志中看到的错误,其中尝试将WP_Error转换为字符串并且它似乎不支持。它可能缺少一个__toString实现,但更多的是它可能以一种意想不到的方式使用。

[Fri Sep 28 12:45:56 2018] [warn] [client 185.220.101.20] mod_fcgid: stderr: PHP Catchable fatal error: 类 WP_Error 的对象无法转换为 /var/www/vhosts/eleganceist.com 中的字符串/httpdocs/wp-includes/shortcodes.php 在第 319 行

这很可能发生在标头周围的某个地方,并引发异常。这个异常没有被捕获,因此会遍历返回的函数调用树,以便某个函数处理它,而没有人这样做。

然后您似乎也有配置错误,但是由于您在执行请求时得到“某些东西”,因此您似乎面临的错误更可能与 PHP 错误有关。

您可以尝试将有问题的函数调用包装在一个try/catch块中并检查WP_Error对象的状态,以查看可能导致错误的原始原因。

例如,您可能会发现它与配置错误有关。

可以在此处找到类似的案例和有关如何尝试定位错误的深入回复。


推荐阅读