プレビューも生成中のままループしてしまう。
対処法
php-dom(php-xml)をインストールする
sudo apt-get install php-dom
どうやらphp7.4ではこのコマンドを実行するとphp-domの代わりにphp-xmlがインストールされるようだ。
httpdを再起動して新しく投稿を作成すると正常に下書き保存ができるようになった。
sudo service apache2 restart
(余談)トラブルシューティングの道のり
デバッグログを出力するため、サーバーにSSH等でログイン後、wordpressのホームディレクトリにあるwp-config.phpを開く。
<?phpより後の任意の場所に、下記を追加する。
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
ターミナルで、sudo service apache2 restartコマンドを実行し、httpdを再起動。
こうすることで、[wordpressのホームディレクトリ]/wp-content/debug.logにエラーが出力されるようになる。
今回はこんな感じのログが出力されていた。
[01-Apr-2021 13:19:24 UTC] PHP Fatal error: Uncaught Error: Class 'DOMDocument' not found in /home/ubuntu/wordpress/wp-content/themes/cocoon-master/lib/open-graph.php:102
Stack trace:
#0 /home/ubuntu/wordpress/wp-content/themes/cocoon-master/lib/open-graph.php(86): OpenGraphGetter::_parse()
#1 /home/ubuntu/wordpress/wp-content/themes/cocoon-master/lib/blogcard-out.php(175): OpenGraphGetter::fetch()
#2 /home/ubuntu/wordpress/wp-content/themes/cocoon-master/lib/blogcard-out.php(24): url_to_external_ogp_blogcard_tag()
#3 /home/ubuntu/wordpress/wp-content/themes/cocoon-master/lib/blogcard-out.php(56): url_to_external_blog_card_tag()
#4 /home/ubuntu/wordpress/wp-includes/class-wp-hook.php(292): url_to_external_blog_card()
#5 /home/ubuntu/wordpress/wp-includes/plugin.php(212): WP_Hook->apply_filters()
#6 /home/ubuntu/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1721): apply_filters()
#7 /home/ubuntu/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(835): WP_REST_Posts_Controller->prepare_item_for_respo in /home/ubuntu/wordpress/
wp-content/themes/cocoon-master/lib/open-graph.php on line 102
コメント