为什么php模块不知道安装?

In my server, when I run this line:

$dom = new DOMDocument;

It throws:

[Tue Jul 10 21:57:21.446136 2018] [:error] [pid 32011] [client 167.99.34.190:27323] PHP Warning:  require_once(DOMDocument.php): failed to open stream: No such file or$
[Tue Jul 10 21:57:21.446181 2018] [:error] [pid 32011] [client 167.99.34.190:27323] PHP Fatal error:  require_once(): Failed opening required 'DOMDocument.php' (includ$

Which means I have to install php-xml module.

I'm doing it using this command:

sudo apt-get install php-xml

And then:

sudo service apache2 restart

But still the result of echo "XML: ", extension_loaded('xml') ? 'OK' : 'MISSING'; is MISSING. Why? And how can I install it?

I resolved the problem by specifying the exact php version in the command:

sudo apt-get install php7.0-xml
sudo service apache2 restart