Error Laravel after MariaDB updated

I’m having problems with some customers, after the database was updated to version 10.2.35. Customers using Laravel (older versions) have reported errors on their website and many have stopped working after this upgrade. Has any website presented this problem?

ErrorException in WelcomeController.php line 155:Undefined offset: 0

Hi @inventdigital

Sorry for the late reply, I’ve been researching but have not found much on this other than code issues. Most cases that error means that an empty array is being returned. Too generic an error to know for sure if its related to the mariadb upgrade.

I could not find a mariadb \ mysql compatibility matrix for laravel versions either. So I cannot confirm if that is the issue, but this is likely if the data is intact. Would have to put the site back on the original mariadb version with the same data to confirm.

I would run this by an experienced Laravel developer first, if possible.

If not my next step would be to downgrade mariadb, which can be a bit of a pain.

To downgrade you would mysqldump (backup) all dbs and privilege’s then reinstall the original mariadb verion with an empty datadir, restore the dumps and privilege’s.

If you took a backup of the original versions datadir before upgrade you could reinstall mariadb with an empty datadir then stop mariadb and restore the original datadir then start it up again. Don’t try to start up an older mariadb version using an upgraded datadir.

If you need more specifics on how to fully remove the existing mariadb version and install the old one let me know.

Hi inventdigital,

I had two cases wherein I moved a website to a newly setup Interworx server and then that website wasn’t working properly, no values were being written, turns out that Mariadb’s sql_mode defaults to strict.

Ex: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Can just set it to none

in /etc/my.cnf

Add: sql_mode=""

then restart mysql

After I did that, the websites worked.

1 Like

Thanks @dcoeli and Welcome!

The sql_mode settings would normally persist with an upgrade as yum does not over-write those conf files. Depends on the version @inventdigital upgraded from. If the original version was prior to strict mode becoming default this could be the issue.

Hi

We do not use laravel but @nico does and has very recently tested moving a laravel site from cpanel to IW (centos 7 - IW-CP 6.9)

The reported blank pages (website not working or displaying) and as well as the MariaDB my.cnf setting, had to change PHP to 7.3 as it is a bug in MariaDB for PHP earlier re connections.

So, if still not working, change PHP to 7.3 and it should start to display if it is same issues as seen by Nico

Kudos to @Nico

Many thanks

John

@inventdigital @d2d4j

Hi whatever you do, DO NOT downgrade MariaDB this will give you more issues. The problem is with MariadDB update causing this, there is a patch and good bug report about this. One solution is to upgrade to phpv7.3 or higher. But please do realise your clients using ‘old’ software so best would be to realy advise them to upgrade everything [ Laravel and PHP coding ] When the patch will be applied by Interworx I can’t say, but cPanel has already patched it. Friday the 13th was my lucky day to be confronted with it :wink: Here are some details: Bug: MDEV-24121

https://jira.mariadb.org/browse/MDEV-24121

Note: enable debug in .env file, this will give you much more information.

1 Like

Hi

Just a word of warning re setting my.cnf detail as posted earlier

Can just set it to none

in /etc/my.cnf

Add: sql_mode=""

then restart mysql

After I did that, the websites worked.

This will stop the import of databases using Phpmyadmin and also import from another server (cpanel and I guess interworx, plesk etc…)

It creates the database(s) but does not populate them, so the databases have no tables

also you cannot run mysql_upgrade after a MariaDB update

Kudos to Nico for reporting this issue and resolving this issue over many Hours yesterday

Many thanks

John