Cron - Error: database driver problem detected

Cron - Error: database driver problem detected

Maxime Paintendre發表於
Number of replies: 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

評比平均分數: -
In reply to Maxime Paintendre

Re: Cron - Error: database driver problem detected

Leon Stringer發表於
Core developers的相片 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.

評比平均分數:Useful (2)
In reply to Leon Stringer

Re: Cron - Error: database driver problem detected

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.