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

Bitrix Error Log: How to Locate, Enable, and Analyze Logs

3 min read
11.08.2025

Error logs in Bitrix are essential for diagnosing issues such as server misconfigurations, PHP errors, or database-related problems. Understanding how to access and interpret these logs can help resolve issues faster.

Bitrix Error Log Locate Enable Analyze
Bitrix logs — sites/example/php_interface/error.log and dbconn.php.

For other Bitrix administration topics, see Setting mbstring.func_overload for Bitrix, Bitrix Virtual Appliance (BitrixVA), Fix "Memcache Extension is Not Loaded", and Bitrix MySQL Freezes — Causes and Solutions.

Locating the Bitrix Error Log

Bitrix-Specific Log Files

Bitrix has a built-in logging system. The logs can be found in:

/bitrix/php_interface/after_connect.php
/bitrix/modules/logs/

Web Server Log Files

Depending on your web server configuration:

  • Apache logs:
  • /var/log/apache2/error.log
  • Nginx logs:
  • /var/log/nginx/error.log
  • PHP-FPM logs:
  • /var/log/php7.x-fpm.log

Custom Error Log for Bitrix

If you have configured Bitrix to write custom logs, check the file path set in the code:

define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/bitrix/log.txt");

Log entries are saved in:

/bitrix/log.txt

Enabling Error Logging in Bitrix

Enable PHP Error Logging

  1. Open your php.ini file:
    sudo nano /etc/php/7.x/apache2/php.ini
  2. Enable logging and set the log file:
    log_errors = On
    
    error_log = /var/log/php_errors.log
  3. Restart the web server:
    sudo systemctl restart apache2

Enable Bitrix Debugging

Edit the dbconn.php file in your Bitrix installation:

define("DEBUG_MODE", true); // Enable debugging

define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/bitrix/log.txt"); // Custom log file

Checking Common Errors in Bitrix Logs

Error Type Typical Error Fix
Database Connection Errors [DB Connection Error]: Unable to connect to the database
  • Verify database credentials in dbconn.php.
  • Check the MySQL service status:
  • sudo systemctl status mysql
PHP Errors PHP Fatal error: Uncaught Error: Call to undefined function
  • Ensure all required PHP modules are installed (e.g., php-mysql, php-gd).
  • Install missing modules:
  • sudo apt install php-mysql php-gd
Module Loading Errors Error: Unable to load module /bitrix/modules/some_module
  • Check if the module directory exists.
  • Reinstall the module if necessary.

Analyzing and Filtering Logs

Search for Specific Errors

Use grep to filter relevant log entries:

grep "ERROR" /bitrix/log.txt

Monitor Logs in Real-Time

Use tail to monitor logs as issues occur:

tail -f /bitrix/log.txt

Clearing Old Logs

Large log files can consume disk space and slow down the server.

  • Check the size of log files:
  • du -sh /bitrix/log.txt
  • Clear log files:
  • > /bitrix/log.txt
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Best Practices for Bitrix Error Logging

  1. Rotate Logs Automatically:
    • Use logrotate to manage large log files:
    • sudo nano /etc/logrotate.d/bitrix
    • Example configuration:
    /var/www/bitrix/log.txt {
    
        daily
    
        rotate 7
    
        compress
    
        missingok
    
        notifempty
    
    }
  2. Set Appropriate Log Levels:
    • Only enable detailed logging for troubleshooting.
    • Disable detailed logs in production to improve performance.
  3. Secure Log Files:
    • Restrict permissions:
    • chmod 600 /bitrix/log.txt
  • Locate and enable logs in /bitrix/log.txt or /var/log/.
  • Use error logs to debug database, PHP, or server-related issues.
  • Regularly clean and rotate logs to optimize performance.
Frequently asked questions
Three places: `/bitrix/php_interface/error_log` if `error_reporting` is set in dbconn.php; PHP's configured `error_log` directive (usually `/var/log/php_errors.log`); and the web server's error log (`/var/log/apache2/error.log` or `/var/log/nginx/error.log`). Bitrix module errors usually land in the first; PHP fatals in the second or third.
Edit `bitrix/php_interface/dbconn.php` and set `error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);` plus `ini_set('error_log', '/path/to/bitrix/php_interface/error_log');`. Don't enable `display_errors` on production — only log.
Drop a logrotate config in `/etc/logrotate.d/bitrix`: `/var/www/*/bitrix/php_interface/error_log { daily; rotate 14; compress; missingok; notifempty; }`. Or move logging to syslog with `ini_set('error_log', 'syslog')` and let the OS handle rotation.
Bitrix core errors include the path `bitrix/modules/main/...`; third-party module errors include `bitrix/modules/./...`; raw PHP errors carry no Bitrix path. For PHP fatals that crash the page, check the web server error log first — Bitrix can't log a fatal that killed PHP before its handler ran.
Related articles
Debugging session_start() Errors in PHP Using Error Logs
Fixing "Internal Server Error" (500) in Apache/Nginx
Fixing session_start(): No Such File or Directory Error in PHP