Cron 403 Error

I'm stumped. I'm testing elgg 3.0. I can't get the cron to run. When I access any cron url directly (such as /cron/daily/) I get a 403 forbidden error. At first I thought maybe it was the htaccess Options -Indexes, but even if I remove that rule I still get the 403 error.

Maybe it's my web host and some setting they have?

  • The recommended way to run cron in Elgg 3 is via command line tool: elgg-cli cron.
    Web access to cron is still possible, but its protected from unauthorised access with a signature. Check your admin settings to find the URL or disable protection.

  • Thank you. I was able to do it via command line. Then I also saw the protected URLs you are talking about. I should be good now. 

  • Well, if you run the cli command once it run once. It doesn't magically start a cron job.

    Instead of cPanel using curl/wget to access the URL, setup cPanel to run the cli command:

    * * * * * /usr/bin/php /path/to/elgg/vendor/bin/elgg-cli cron -q

    Change /usr/bin/php to PHP binary path on your server.

    Change /path/to/elgg/vendor/bin/elgg-cli to the elgg-cli binary on your server. If you have installed Elgg with composer it's in /vendor/bin/elgg-cli, if you installed using ZIP or git clone, it's in the root of your Elgg installation.

  • Note that you no longer need to setup a gazillion jobs for each period. You only need to setup one cron job that hits the main command every minute. Elgg's cron handler will determine, which cron handlers are due and will run them.

    -q flag will supress the output. You can remove it if you want cron logs to be saved on your server (that will flood your server inodes though).

    For testing you can use an -i and -f flags. -i for internval name, -f for force run even if job is not due.


  • Yeah, I realized pretty quickly that the cron won't just magically re-run. LOL! Thank you very much! I got it running.