WordPress AMP移动端优化插件不工作 PHP Fatal error: Uncaught Error: Class 'DOMDocument' not found

安装了accelerated-mobile-pages之后, 帖子URL后面加 /amp访问页面,报500错误,查了日志 /var/log/php7.1-fpm.log发现后台报错,

$ less /var/log/php7.1-fpm.log

显示PHP Fatal error: Uncaught Error: Class 'DOMDocument' not found 

安装php的xml扩展可以解决这个问题。注意PHP 7以后要安装相应版本的,比如我的Debian 9 上面用的php7.1,要安装7.1的扩展:

$ sudo apt-get install php7.1-xml

以下是详细日志:

[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught Error: Class 'DOMDocument' not found in /data/www/ruoguedu.com/wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/includes/utils/class-amp-dom-utils.php:7"
[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "Stack trace:"
[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "#0 /data/www/ruoguedu.com/wp-content/plugins/accelerated-mobile-pages/templates/features.php(6101): AMP_DOM_Utils::get_dom_from_content('<div>WordPress\xE6...')"
[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "#1 /data/www/ruoguedu.com/wp-includes/class-wp-hook.php(286): ampforwp_amp_component_checker('<div>WordPress\xE6...')"
[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "#2 /data/www/ruoguedu.com/wp-includes/plugin.php(203): WP_Hook->apply_filters('<div>WordPress\xE6...', Array)"
[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "#3 /data/www/ruoguedu.com/wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/includes/class-amp-content.php(48): apply_filters('the_content', '<div>WordPress\xE6...')"

[22-Apr-2018 11:09:06] WARNING: [pool www] child 16733 said into stderr: "#4 /data/www/ruoguedu.com/wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/includes/class-amp-content.php(22): AMP_Content->transform()"


更多WordPress经验,参考 https://www.ruoguschool.com

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值