Simple Fix for Moodle “ERROR: This script no longer supports CLI, please use admin/cli/cron.php instead”

Simple fix for the error. 

The Case

We’re using Moodle 2.4 on Ubuntu 12.04.4 LTS in this example:

$ uname -rv
3.2.0-57-virtual #87-Ubuntu SMP Tue Nov 12 22:18:25 UTC 2013

The Problem

After uploading users (CSV file) to Moodle via WebUI, the following error is thrown:

Cron <www-data@moodle> [ -f /usr/share/moodle/admin/cron.php ] && /usr/bin/php -f /usr/share/moodle/admin/cron.php >/dev/null

ERROR: This script no longer supports CLI, please use admin/cli/cron.php instead

Password is omitted in a CSV file, and according to Moodle docs, it should therefore be generated for each user during the next cron job and welcome e-mails sent out.

Simple Fix

To fix the issue, open the Moodle cron file for editing:

# vim /etc/cron.d/moodle

And change the job appropriately to use admin/cli/cron.php:

# Regular cron jobs for the moodle package
*/15 * * * * www-data [ -f /usr/share/moodle/admin/cli/cron.php ] && /usr/bin/php -f /usr/share/moodle/admin/cli/cron.php > /dev/null 2>&1

Also rename the admin/cron.php file if not intended to use online:

# cd /usr/share/moodle/admin
# mv cron.php cron.php.backup

Leave a Reply

Your email address will not be published. Required fields are marked *