In Bitrix CMS (now known as Bitrix24), cron_events.php is a crucial script used to automate scheduled tasks such as:
If cron_events.php is not running correctly, it can lead to delayed system tasks, unsent emails, and performance issues. Below is a step-by-step guide to properly configure it.
The cron job script is typically located in the Bitrix modules directory. The exact path depends on your installation.
/home/USER/public_html/bitrix/modules/main/tools/cron_events.php
Replace USER with your actual cPanel/VPS username. Verify the file exists:
ls -lah /home/USER/public_html/bitrix/modules/main/tools/cron_events.php
If the file doesn't exist:
find /home/USER -name "cron_events.php" 2>/dev/null
Before setting up an automated cron job, test the script manually to ensure it works without errors.
php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php
Replace USER with your actual username. You should see output indicating execution (or no output if configured for silent operation).
/usr/bin/php -f ... or find your PHP binary with which php.
If there are no errors, proceed to set up the cron job. If errors appear, address them before automation (see Troubleshooting section).
Edit your user's crontab (scheduled tasks):
crontab -e
This opens the crontab in your default editor (usually vi or nano).
*/15 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php > /dev/null 2>&1
*/5 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php > /dev/null 2>&1
0 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php > /dev/null 2>&1
Important: Replace USER with your actual username and /usr/bin/php with your PHP path if different.
*/15 * * * * = Every 15 minutes> /dev/null 2>&1 = Redirects all output to null (silent operation)crontab -l
You should see your cron_events.php entry in the list.
# Ubuntu/Debian
grep CRON /var/log/syslog | tail -20
# CentOS/RHEL
grep CRON /var/log/cron | tail -20
# Check for your specific job
grep "cron_events" /var/log/syslog | tail -10
For troubleshooting, modify your cron job to log output:
*/15 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php >> /home/USER/cron_log.txt 2>&1
Check the log file after cron should have run:
tail -f /home/USER/cron_log.txt
| Issue | Solution |
|---|---|
php: command not found |
Use full PHP path: /usr/bin/php -f ... (find with which php) |
| Cron job runs but does nothing | Check Bitrix admin panel > Settings > Cron jobs (ensure enabled) |
cron_events.php missing |
Download from Bitrix or restore from backup |
| Errors in cron logs | Run manually: php -f cron_events.php and fix PHP errors |
| Permission denied errors | Check file permissions: chmod 755 cron_events.php |
| Wrong PHP version | Ensure using correct PHP version for your Bitrix installation |
| Cron not executing at all | Check cron service status: systemctl status cron |
If using cPanel with a shared hosting environment:
Command: /usr/local/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php
Common Settings: Every 15 Minutes (*/15 * * * *)
/usr/local/bin/php as the PHP path. Check with your hosting provider if unsure. You can also use the email notification option in cPanel cron to receive alerts if the job fails.
With cron_events.php properly configured, your Bitrix site will automatically handle scheduled tasks, ensuring emails are sent, cache is cleared, and background processes run smoothly!