New guidance on phpBB and system crons

A recent release of my digests extension revealed underlying problems not only in the extension, but also on guidance I’ve been giving for setting up phpBB and system crons. I can’t seem to edit the Wiki page, but I left notes on my digests extension discussion forum. I need to place them here for wider visibility. I will update the Wiki page when that technical issue is resolved.

With my digests extension, it’s generally important for digests to be mailed on time. Otherwise it depends on board traffic to send digests, which on sites with low traffic could result in significant delays in receiving digests.

There are two ways to do this in an automated way:

  • Create a system cron
  • Use a phpBB cron, but use a tool to call the board at least hourly, which kicks off phpBB’s cron process, which includes handling any scheduled outgoing digests

With a system cron, it turns out that you can’t use a semicolon to separate commands on one line in most cases. So this guidance is wrong in most cases. It all depends on the Linux shell used by the root user, which is usually bash. So when programming a cron job, to get two commands to work on one line, you need this instead:

cd /path/to/board && ./bin/phpbbcli.php cron:run

The && acts as a conditional, essentially saying that if the command to the left of the && succeeds, then issue the command to its right.

On my test board I also discovered I had to change the permissions on the /bin/phpbbcli.php program to 755, as the cron needs the execute permission, and it’s lacking with 644 permissions. This is not ideal as this introduces a potential security issue. Considering it’s just one file, I consider the security implications minor at best. With a system cron, you need to program a real cron job and tell phpBB to not use its built in cron based on board traffic: ACP > General > Server settings > Server settings > Run periodic tasks from system cron > Yes

If you want to use phpBB’s built in cron, you need to call it at least hourly and create a cron using curl, wget or lynx to hit your phpBB board as if it were a browser. If you follow the Wiki approach it causes a HTTP redirect, which basically causes it to fail. So the cron should look more like this (all on one line):

* * * * * curl -k -A='Mozilla/5.0' https://www.yourforum.com/board/app.php/cron/cron.task.cron_task

The key here is to use app.php in the cron, to avoid the redirect.


If you administer a phpBB board, you should find my book Mastering phpBB Administration invaluable. Learn lots of tips, tricks and secrets I learned from serving over 400 clients. Paper and Kindle versions available.

Leave a Reply

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