Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

How to Set Up cron_events.php for Bitrix

4 min read
04.03.2025

1. Check if cron_events.php Exists

The cron job script is typically located in the Bitrix modules directory. The exact path depends on your installation.

Bitrix cron_events.php Setup Guide
cron_events.php — Bitrix's queue worker; must be in cron.

For other Bitrix operations topics, see Bitrix Virtual Appliance (BitrixVA), What is bitrixsetup.php?, and Bitrix Error Log — Locate, Enable, Analyze.

Standard Path for Self-Hosted Bitrix

/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 is Missing

If the file doesn't exist:

  1. Check if you have a different Bitrix installation path
  2. Restore from your Bitrix backup
  3. Download a fresh copy from the official Bitrix24 website (requires account access)
  4. Check if it's in an alternative location:
    find /home/USER -name "cron_events.php" 2>/dev/null

2. Manually Run cron_events.php

Before setting up an automated cron job, test the script manually to ensure it works without errors.

Manual Test Command

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).

Expected Results

  • No output or minimal status messages: Script executed successfully
  • PHP errors displayed: Configuration or permission issues
  • "Nothing to do" message: No scheduled tasks pending (normal)
Testing Tip: If you get "php: command not found" errors, use the full PHP path: /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).

Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

3. Set Up the Cron Job

Open the Crontab File

Edit your user's crontab (scheduled tasks):

crontab -e

This opens the crontab in your default editor (usually vi or nano).

Add the Cron Job Entry

Every 15 Minutes (Recommended for Bitrix)

*/15 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php > /dev/null 2>&1

Every 5 Minutes (For Busy Sites)

*/5 * * * * /usr/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php > /dev/null 2>&1

Every Hour (Minimum Frequency)

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.

Cron Syntax:
  • */15 * * * * = Every 15 minutes
  • > /dev/null 2>&1 = Redirects all output to null (silent operation)
  • For debugging, you can redirect output to a log file instead

4. Check if Cron is Running

Verify Cron Job is Added

crontab -l

You should see your cron_events.php entry in the list.

Check Cron Execution Logs

Check System Logs for Cron Activity

# 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

Alternative: Add Logging for Debugging

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

5. Troubleshooting Common Issues

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

6. Alternative: Set Up Cron in cPanel

If using cPanel with a shared hosting environment:

  1. Log into cPanel
  2. Navigate to Advanced > Cron Jobs
  3. Under "Add New Cron Job":

cPanel Cron Configuration

Command: /usr/local/bin/php -f /home/USER/public_html/bitrix/modules/main/tools/cron_events.php

Common Settings: Every 15 Minutes (*/15 * * * *)
cPanel Note: cPanel often uses /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!

Frequently asked questions
Every minute: `* * * * * /usr/bin/php -f /var/www/site/bitrix/modules/main/tools/cron_events.php >/dev/null 2>&1`. Bitrix's agents are designed for minute-resolution; less frequent and queued mail piles up. The script self-terminates if there's nothing to do, so the cost is just a PHP startup.
Yes, one cron entry per Bitrix installation. Each site has its own queue, agents, and scheduled tasks. Don't try to share — they need their own DB connections and module state. For 5+ sites on one server, consider running them as different OS users for permission isolation.
The same user that owns the Bitrix files — usually `www-data` on Debian/Ubuntu, `apache` on RHEL/CentOS, or a per-site user on cPanel. Wrong user means cron_events.php can't read/write Bitrix's files, leading to silent failure or permission errors in logs. `crontab -u -e` to edit the right user's tab.
Bitrix maintains a last-run timestamp. Look at `bitrix/modules/main/tools/cron_events.php` via the admin panel under Settings → Performance → Performance Panel → Agents — shows last execution. CLI verify: `crontab -l` and confirm the entry; then `tail -f /var/log/cron` to see the entries firing; then check Bitrix-side timestamps update.
Related articles
Understanding the .cagefs Folder in CloudLinux (cPanel Hosting)
How to Link a Domain with Yahoo Mail and Use It as a Corporate Email
Fixing "A Fatal Error or Timeout Occurred" by Increasing PHP Limits