Cron - Error: database driver problem detected

Cron - Error: database driver problem detected

por Maxime Paintendre -
Número de respostas: 2

Hello everyone,

I'm having a problem running the cron.php file.

in fact, i wanted to run this file by hand because i had a course copy problem and when i tried to run it via : 

php admin/cli/cron.php

I got a few 'deprecated' errors.

and especially at the very end : 

`<p>Error: database driver problem detected</p>

<p>The site administrator should verify server configuration</p><p>PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP.</p>`


my moodle is in version 4.11 and hosted on a debian 11. i'm in php 7.4 fpm with the mysqli extension installed and active.

Any ideas? 

Thanks in advance

Média das avaliações:  -
Em resposta à Maxime Paintendre

Re: Cron - Error: database driver problem detected

por Leon Stringer -
Imagem de Core developers Imagem de Particularly helpful Moodlers

It looks like the PHP environment for your command line is different to that used by the web server. See the note in bold in the documentation. Try php -v to report the command line PHP version, and php -i | grep -i mysqli to see if the MySQLi extension is enabled.

When running admin/cli/cron.php by hand run it the same user as your web server, for example, sudo -u www-data php admin/cli/cron.php. If you do not files in Moodledata may not have the correct ownership which can cause problems.

my moodle is in version 4.11

Presumably you mean 4.1.1 in which case your site is missing over six months of bug and security fixes.

Média das avaliações: Useful (2)
Em resposta à Leon Stringer

Re: Cron - Error: database driver problem detected

por Maxime Paintendre -
oh, sorry I made a mistake. i'm in v3.11

u're totally right, php -v sends me back v8.1 while phpinfo in moodle gives me v7.4.

so I ran the file with the correct php and everything worked fine.
many thanks.