php - 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
有人知道如何解决这个问题吗?
谢谢
解决方案
错误后您看不到任何内容的原因很可能是由于您在日志中看到的错误,其中尝试将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对象的状态,以查看可能导致错误的原始原因。
例如,您可能会发现它与配置错误有关。
可以在此处找到类似的案例和有关如何尝试定位错误的深入回复。
推荐阅读
- amazon-web-services - aws s3 存储桶获取推荐人策略:strict-origin-when-cross-origin
- xsl-fo - 使用 Apache FOP 强制条件页数
- sql - MS SQL 到 SQLite 语法
- ffmpeg - hls的多个字幕
- cdn - 内容交付与虚拟服务器
- json - 从路由器“获取” - 如何在 .then .catch 中将“res.status(400).json('在此处输入失败消息')”作为错误处理?
- php - 在数据库中的一列上使用多个条件查询,laravel
- python - 如何从天和小时转换为小时?
- rust - 取消引用 Box 时是否会泄漏内存?
- java - 在 Java Web 应用程序中集成 SSRS 2016 报告需要帮助