Uncaught Error: Call to a member function real_escape_string() on null

Re: Uncaught Error: Call to a member function real_escape_string() on null

by Leon Stringer -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers

So you're running the Moodle cron in two different ways? One shows an error and one does not? Maybe different PHP binaries (executables) are being used: the one without error has the required PHP extensions – such as MySQLi for database access – and the other is missing these extensions.

If you're getting the error every minute then presumably it's the crontab (scheduled task) entry that's wrong. What is the path to the PHP binary currently? Try changing it to /usr/bin/php.

(Mods: This post may need moving to the General help forum).

In reply to Leon Stringer

Re: Uncaught Error: Call to a member function real_escape_string() on null

by Andrew Domarkas -
This was the right lead.
In cPanel-account I now use in cron:
/opt/cpanel/ea-php74/root/usr/bin/php /home/accountname/public_html/academy/admin/cli/cron.php >/dev/null 2>&1

Perhaps someone can use it.