Missing PHP extensions (xml)

Good afternoon all, First time poster, long time user of Librenms. I have an extremely strange issue with my installation. I always seem to have issues after running apt-get updates!

After updating my site wouldn’t open. it couldn’t load the “curl” module. After spending last night on it I was able to resolve it by enabling it in the PHP 7.4 config. After cycling apache2 I was prompted with two more extensions to install/enable. “mysqlnd” and “xml”. I was able to get mysqlmd resolved with a similar task to the “curl” issue however the “xml” extension will not load.

Thing I have done…
Removed all previous versions of PHP.
Made sure that the modules needed are installed and in the correct directory.
Ran phpinfo.php to verify Apache is pointing to the right location.
Uninstalled php7.4-xml and reinstalled it.

Here’s what happens. When I enable the extension and restart Apache I get a 500 error bad request. When I disable the extension and restart appache I get a message saying it needs to be installed. PHP needs to make up its dang mind, does it want it enabled or not???

Below is the output of Validate. Please ignore the polling errors, it works fine and I have no gaps in my graphs. Also, my install isn’t in the default location because I run a few other sites on this machine.

=========
UN:/var/www/librenms$ sudo -u librenms ./validate.php

Component Version
LibreNMS 1.59-33-ge235c59d2
DB Schema 2019_12_17_151314_add_invert_map_to_alert_rules (154)
PHP 7.4.1
MySQL 10.1.43-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.9.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Missing PHP extension: xml
[FIX]:
Please install xml
[WARN] Some devices have not been polled in the last 5 minutes. You may have performance issues.
[FIX]:
Check your poll log and see: http://docs.librenms.org/Support/Performance/
Devices:
10.0.50.50
10.80.1.95
10.80.1.96
192.168.200.5
192.168.200.6
192.168.200.7
10.0.50.30
192.168.200.17
192.168.200.22
192.168.200.20
192.168.200.11
192.168.200.15
192.168.200.4
192.168.200.9
192.168.200.23
and 8 more…

=========
My daily is also clean…

UN:/var/www/librenms$ sudo -u librenms ./daily.sh
Updating to latest codebase OK
Updating Composer packages OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK

The only thing I’m thinkin is maybe I need to enable it??? I think I had to do that with the mysqlnd module if I’m not mistaken, but I don’t see anything about enabling that as a module.
Trust me, I’ve looked everywhere for this and XML just isn’t out there and the same solutions that fix the mysqlnd issue (thats out there a lot) don’t appear to be working for the xml.so issue.

Please let me know what you need in order to help.
Thanks!

Just a heads up, I found an article that states that installing the xml.so from 7.2 will work on 7.4. I can confirm it doesn’t and here’s my process.

sudo apt-get install php7.2-xml
sudo mv /usr/lib/php/20190902/xml.so /usr/lib/php/20190902/xml.so.old
sudo cp /usr/lib/php/20170718/xml.so /usr/lib/php/20190902/xml.so
sudo nano /etc/php/7.4/apache2/php.ini
**Uncommented the extension=xml line
sudo systemctl restart apache2
…And it breaks the server (Error 500)
Commented and I’m back to…

Missing PHP extensions. Please install and enable them on your LibreNMS server.

xml

:laughing:

When it’s enabled and you get error 500, do you see any useful information in your apache error logs or librenms.log?

I checked all the logs before and after uncommented the extensions=xml line.
Quick Google-Fu indicated that php-json needed to be installed.
Ran sudo apt-get install php-json
Restarted Apache2 and checked the logs again, no change.

Looks like the issue starts with this…
Uncaught Error: Interface ‘JsonSerializable’ not found in /var/www/librenms/vendor/laravel/framework/src

However I cannot locate a solution.

sudo nano /var/log/apache2/access.log
(Nothing Before enabling XML)
(Nothing After enabling XML)
(Nothing After adding php-json)

sudo nano /var/log/apache2/other_vhosts_access.log
(Before enabling XML)
server.domain.name:80 IP_Address - - [20/Jan/2020:14:13:04 -0500] “GET / HTTP/1.1” 200 359 “-” "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130$
server.domain.name:80 IP_Address - - [20/Jan/2020:14:13:04 -0500] “GET /favicon.ico HTTP/1.1” 200 15388 “http://server.domain.name/” "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/$
(After enabling XML)
server.domain.name:80 IP_Address - - [20/Jan/2020:14:20:51 -0500] “GET / HTTP/1.1” 500 185 “-” "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130$
(After adding php-json)
server.domain.name:80 IP_Address - - [20/Jan/2020:14:32:11 -0500] “GET / HTTP/1.1” 500 185 “-” "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130$

sudo nano /var/log/apache2/error.log
(Before enabling XML)
[Mon Jan 20 19:11:22.736464 2020] [mpm_prefork:notice] [pid 1599] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Mon Jan 20 19:11:22.779588 2020] [core:notice] [pid 1599] AH00094: Command line: ‘/usr/sbin/apache2’
(After enabling XML)
[Mon Jan 20 14:19:59.029380 2020] [mpm_prefork:notice] [pid 1599] AH00169: caught SIGTERM, shutting down
[Mon Jan 20 14:19:59.106726 2020] [mpm_prefork:notice] [pid 8732] AH00163: Apache/2.4.29 (Ubuntu) configured – resuming normal operations
[Mon Jan 20 14:19:59.106761 2020] [core:notice] [pid 8732] AH00094: Command line: ‘/usr/sbin/apache2’
[Mon Jan 20 14:20:51.271805 2020] [php7:error] [pid 8738] [client IP_Address:64985] PHP Fatal error: Uncaught Error: Interface ‘JsonSerializable’ not found in /var/www/librenms/vendor/laravel/framework/src$
[Mon Jan 20 14:20:51.274441 2020] [php7:error] [pid 8738] [client IP_Address:64985] PHP Fatal error: Uncaught Error: Interface ‘JsonSerializable’ not found in /var/www/librenms/vendor/laravel/framework/src$
(After adding php-json)
[Mon Jan 20 14:32:11.117208 2020] [php7:error] [pid 17426] [client IP_Address:65214] PHP Fatal error: Uncaught Error: Interface ‘JsonSerializable’ not found in /var/www/librenms/vendor/laravel/framework/sr$

The daily.log shows “The requested PHP extension ext-xml is missing”
More Google-Fu indicated it needs to be installed with the below command.
sudo apt-get install php-xml

Installed, restarted apache then ran ./daily.php and ./validate.php and I’m still getting the warning message.

Updating Composer packages
> LibreNMS\ComposerHelper::preInstall
^[[32mLoading composer repositories with package information^[[39m
^[[32mInstalling dependencies from lock file^[[39m
^[[37;41mYour requirements could not be resolved to an installable set of packages.^[[39;49m

  • Problem 1*
    • The requested PHP extension ext-xml * is missing from your system. Install or enable PHP’s xml extension.*
      Returned: 0

Looks like after you apt update you said yes to everything and that may have removed dependencies.

I would go to the install docs at docs.librenms.org and run all the packages that are needed for your distro.

Lovely… Thanks for that… Now my MariaDB cant connect and it can’t recognize my version of SQL…

UN@SRV:/var/www/librenms$ sudo -u librenms ./validate.php
PHP Fatal error: Uncaught Error: Call to undefined function Composer\Json\json_decode() in phar:///var/www/librenms/composer.phar/src/Composer/Json/JsonFile.php:156
Stack trace:
#0 phar:///var/www/librenms/composer.phar/src/Composer/Factory.php(290): Composer\Json\JsonFile->validateSchema()
#1 phar:///var/www/librenms/composer.phar/src/Composer/Factory.php(576): Composer\Factory->createComposer()
#2 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(354): Composer\Factory::create()
#3 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(471): Composer\Console\Application->getComposer()
#4 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(169): Composer\Console\Application->getPluginCommands()
#5 phar:///var/www/librenms/composer.phar/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun()
#6 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(106): Symfony\Component\Console\Application->run()
#7 phar:// in phar:///var/www/librenms/composer.phar/src/Composer/Json/JsonFile.php on line 156
PHP Fatal error: Uncaught Error: Call to undefined function Composer\Json\json_decode() in phar:///var/www/librenms/composer.phar/src/Composer/Json/JsonFile.php:156
Stack trace:
#0 phar:///var/www/librenms/composer.phar/src/Composer/Factory.php(290): Composer\Json\JsonFile->validateSchema()
#1 phar:///var/www/librenms/composer.phar/src/Composer/Factory.php(576): Composer\Factory->createComposer()
#2 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(354): Composer\Factory::create()
#3 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(471): Composer\Console\Application->getComposer()
#4 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(169): Composer\Console\Application->getPluginCommands()
#5 phar:///var/www/librenms/composer.phar/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun()
#6 phar:///var/www/librenms/composer.phar/src/Composer/Console/Application.php(106): Symfony\Component\Console\Application->run()
#7 phar:// in phar:///var/www/librenms/composer.phar/src/Composer/Json/JsonFile.php on line 156

Component Version
LibreNMS 1.59-40-g0439a6202
DB Schema Not Connected (0)
PHP 7.4.1
MySQL ?
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[FAIL] No composer available, please install composer
[FIX]:
https://getcomposer.org/

I verified my DB is there and in-tact. Also verified Php7.4 is installed.
Why validate is not seeing them is confusing.

First of all let’s get something straight you messed up your own system by running apt get updates and not reading.

Second I’m trying to help you and those kind of comments are not appreciated.

I was being sarcastic, sorry. So if MariaDB is running, the Database can be connected to with my Librenms config UN/PW, I’m curious what changed. I’m not doubting an apt update caused this… it happens every damn time I update my system and normally I can resolve the issues in a day and get Librenms back up to fully functioning within a day. I’m going on Day 3. :frowning:

For anyone still trying to find a solution,

I was able to install the xml extension by following instructions in this link https://www.cloudbooklet.com/install-php-7-4-on-ubuntu/

basically You need to add a ppa to get the now latest(7.4) PHP extensions.