Not working on Ubuntu 24.04 LTS

Hi!
Matomo is not working anymore after updating Ubuntu server from 22 to 24.
PHP is 8.3
MySQL is 8.0.39-0ubuntu0.24.04.2 (Ubuntu)

It’s pretty urgent as I’m providing statistics for the popular non profit organization in Croatia.

Please help!

Thanks!

2024/09/18 15:25:52 [error] 10921#10921: *57 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "Piwik\Db\Adapter\MYSQLI_OPT_LOCAL_INFILE" in /var/www/matomo/core/Db/Adapter/Mysqli.php:36
Stack trace:
#0 /var/www/matomo/core/Db/Adapter.php(50): Piwik\Db\Adapter\Mysqli->__construct()
#1 /var/www/matomo/core/Db.php(158): Piwik\Db\Adapter::factory()
#2 /var/www/matomo/core/Db.php(57): Piwik\Db::createDatabaseObject()
#3 /var/www/matomo/core/Db.php(346): Piwik\Db::get()
#4 /var/www/matomo/core/Option.php(290): Piwik\Db::fetchAll()
#5 /var/www/matomo/core/Option.php(180): Piwik\Option->autoload()
#6 /var/www/matomo/core/Option.php(50): Piwik\Option->getValue()
#7 /var/www/matomo/plugins/CoreAdminHome/CustomLogo.php(54): Piwik\Option::get()
#8 /var/www/matomo/plugins/CoreAdminHome/CustomLogo.php(69): Piwik\Plugins\CoreAdminHome\CustomLogo->isEnabled()
#9 /var/www/matomo/core/ExceptionHandler.php(135): Piwik\Plugins\CoreAdminHome\CustomLogo->hasSVGLogo()
#10 /var/www/matomo/core/ExceptionHandler.php(101): Piwik\ExceptionHandler::getE...; PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 118784 bytes) in /var/www/matomo/core/FrontController.php on line 131" while reading response header from upstream, client: 78.0.87.243, server: matomo.thevegcat.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.3-fpm.sock:", host: "matomo.thevegcat.com"

Feckit, I did PHP downgrade to 8.1.
It would be nice to avoid situations such as this one.

Another thing I had to do is to manually install PHP with GMP extension:

$ sudo apt-get install php8.1-gmp

That is odd. I just double checked my install of Matomo on Ubuntu Mate 24.04.1 LTS and php -v returns

PHP 8.3.6 (cli) (built: Sep 30 2024 15:17:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies

Perhaps increasing memory_limit in php.ini to 512M or 1024M will help.

It’s about PHP version, not about memory. If PHP has no memory, it woudln’t throw undefined constant but out of memory or such an error.

[quote=“Hrvoje Lončar, post:1, topic:59708, username:H.Lo”]
PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
[/quote] is taken from your error messages earlier in the thread. The point I was trying to make is I am currently running Matomo on my machine on Ubuntu Mate 24.04.1 LTS with PHP 8.3.6 so it must be possible. I cannot see how it is about the PHP version. Maybe I am missing the point.

I had this same problem. Fixed by running:

sudo a2dismod php8.1
sudo a2enmod php8.3
sudo systemctl restart apache2

This is: disabling php8.1, enabling php8.3 and restarting apach2

1 Like

Thank you very much! I am so glad you posted this/shared it with us! I upgraded from Ubuntu 22.04 to 24.04 and could not get php-admin or wordpress to load. Once I ran the last two commands everything started working again.

1 Like