Error: Class 'DOMDocument' not found

Hey guys, I’m a total newb trying to migrate my Kirby site to Digital Ocean, and stumbling/learning command line stuff no the way.

On my new Digital Ocean environment, I’m getting the following error:

Fatal error: Method Kirbytext::__toString() must not throw an exception, caught Error: Class 'DOMDocument' not found in /var/www/blog_beta/kirby/helpers.php on line 0

I saw another post with a similar error earlier that solved it by installing the DOM extension, but from what I understand, the DOM extension is already enabled… (Again, total newb here trying to manage a new environment from command line instead of cPanel)

I also noticed that Kirby requires mbstring, but from what I understand, I have that enabled too.

Here is my phpinfo: https://beta.meltajon.com/test-phpinfo.php

Any ideas?

mb_string seems to be there, but I can’t see anything of DOMDocument in your phpinfo.

Ah, I saw “DOM” listed there under “Module Authors” so I assumed it was enabled.

Total newb question that I can’t quite figure out from Google: can the DOM Extension be enabled without having to recompile/reinstall PHP 7?

Which linux flavor are using? It seems you can install php-xml like this on Ubuntu

sudo apt-get install php-xml
3 Likes

I’m running Ubuntu 16.04. I installed php-xml like you suggested but I’m still getting the same DOM error.

Here’s what the install looked like:

$ sudo apt-get install php-xml

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libxslt1.1 php7.0-xml
The following NEW packages will be installed:
  libxslt1.1 php-xml php7.0-xml
0 upgraded, 3 newly installed, 0 to remove and 44 not upgraded.
Need to get 259 kB of archives.
After this operation, 968 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://sfo1.mirrors.digitalocean.com/ubuntu xenial/main amd64 libxslt1.1 amd64 1.1.28-2.1 [145 kB]
Get:2 http://sfo1.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 php7.0-xml amd64 7.0.13-0ubuntu0.16.04.1 [113 kB]
Get:3 http://sfo1.mirrors.digitalocean.com/ubuntu xenial/universe amd64 php-xml all 1:7.0+35ubuntu6 [1,954 B]
Fetched 259 kB in 0s (717 kB/s)
Selecting previously unselected package libxslt1.1:amd64.
(Reading database ... 86130 files and directories currently installed.)
Preparing to unpack .../libxslt1.1_1.1.28-2.1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.28-2.1) ...
Selecting previously unselected package php7.0-xml.
Preparing to unpack .../php7.0-xml_7.0.13-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-xml (7.0.13-0ubuntu0.16.04.1) ...
Selecting previously unselected package php-xml.
Preparing to unpack .../php-xml_1%3a7.0+35ubuntu6_all.deb ...
Unpacking php-xml (1:7.0+35ubuntu6) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for libapache2-mod-php7.0 (7.0.13-0ubuntu0.16.04.1) ...
Setting up libxslt1.1:amd64 (1.1.28-2.1) ...
Setting up php7.0-xml (7.0.13-0ubuntu0.16.04.1) ...

Creating config file /etc/php/7.0/mods-available/dom.ini with new version

Creating config file /etc/php/7.0/mods-available/simplexml.ini with new version

Creating config file /etc/php/7.0/mods-available/wddx.ini with new version

Creating config file /etc/php/7.0/mods-available/xml.ini with new version

Creating config file /etc/php/7.0/mods-available/xmlreader.ini with new version

Creating config file /etc/php/7.0/mods-available/xmlwriter.ini with new version

Creating config file /etc/php/7.0/mods-available/xsl.ini with new version
Setting up php-xml (1:7.0+35ubuntu6) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for libapache2-mod-php7.0 (7.0.13-0ubuntu0.16.04.1) ...

Still getting the same error… :confounded:

Have you restarted apache?

Ah, restarted and it works! Thank you!

I feel like I leveled up with my command line skills lol