How to Set Up cron_events.php for Bitrix
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.
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:
- Check if you have a different Bitrix installation path
- Restore from your Bitrix backup
- Download a fresh copy from the official Bitrix24 website (requires account access)
- 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)
/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).
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.
*/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:
- Log into cPanel
- Navigate to Advanced > Cron Jobs
- 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 * * * *)
/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!


