Class DOM Document not found

  • Post author:
  • Post last modified:November 10, 2024
  • Reading time:1 mins read

1. Error

After installing the W3 Total Cache plugin in a WordPress based website, the Settings web page for the plugin indicated a critical error. After examining the error log file the following error was observed.

PHP message: PHP Fatal error:  Uncaught Error: Class "DOMDocument" not found in /wp-content/plugins/w3-total-cache/Util_Ui.php:1521

2. Solution

The reason for the error was that the PHP DOM extension, which is a part of PHP’s XML extension, was missing on the server. The problem was rectified by installing the php-xml package, using the following commands.

$ sudo apt-get update
$ sudo apt-get install php8.3-xml

The web server was restarted with the command,

$ sudo systemctl restart nginx

Karunesh Johri

Software developer, working with C and Linux.