Diagnosing and troubleshooting 500 errors on 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Diagnostics and Resolution of 500 Errors on 1C-Bitrix

HTTP 500 — Internal Server Error — means the server couldn't process the request, but doesn't say why. In Bitrix context this is most frequent and most annoying failure type: user sees standard error page, but admin panel may have no records. Reason is 500 error occurs before Bitrix initializes its logging system. Let's explore where to look for real cause and how to fix it.

Why Bitrix is Silent on 500

Bitrix initialization chain: index.phpheader.php/bitrix/modules/main/include/prolog_before.php → DB connection → modules initialization → URL processing → component call. If PHP process crashes at any stage before exception_handling initialization from .settings.php, Bitrix can't log error to its journal. Only web server log and PHP remain.

Diagnostics Algorithm

Step 1. Find error log.

Check in following order:

  1. PHP error log — path determined by error_log directive in php.ini or php-fpm pool config. Typical locations: /var/log/php-fpm/www-error.log, /var/log/php/error.log.
  2. Web server log — for nginx: /var/log/nginx/error.log, for Apache: /var/log/apache2/error.log or /var/log/httpd/error_log.
  3. Bitrix log/bitrix/modules/main/tools/log.txt (if configured) and event log in DB.

If all three logs empty — PHP process killed by OOM-killer or segfault. Check /var/log/syslog or dmesg for Out of memory: Kill process or segfault entries.

Step 2. Determine which URL causes error.

500 can be global (all pages) or local (specific section). This narrows search immediately:

Scale Likely causes
All pages Error in init.php, dbconn.php, .settings.php; DB crash; memory exhaustion
Only admin panel Session corruption; error in admin script
Single section/page Error in component or template; corrupted iblock data
Only POST requests post_max_size exceeded; CSRF check failure
Periodically Cache write race conditions; DB connection pool exhaustion

Step 3. Reproduce with debug enabled.

Temporarily add to index.php start (before Bitrix include):

ini_set('display_errors', 1);
error_reporting(E_ALL);

Or create separate test file test500.php with minimal kernel include:

require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
echo 'Kernel loaded';

If this file returns 500 — problem is in core or config. If works — problem in specific template or component.

Main Causes and Solutions

1. Memory limit exhaustion.

Most common cause. Bitrix consumes 128-256 MB on typical catalog page. Mass operations (import, search index building) can require 512 MB and more.

Log symptom: Allowed memory size of N bytes exhausted. Solution: increase memory_limit in php.ini or .htaccess to 256M-512M. If consumption is abnormally high — profile via xdebug or Blackfire: possible memory leak in element processing loop.

2. Errors in init.php and dbconn.php.

File /bitrix/php_interface/init.php included on each hit. Syntax error or Fatal Error in it downs entire site. Similarly dbconn.php (deprecated, but often modified file with DB connection params).

Check: rename init.php to init.php.bak. If site works — error is in it. Restore file and search problem line via binary search: comment half of code, check, narrow down.

3. .htaccess conflict.

Bitrix creates .htaccess in root and /bitrix/. Directives php_value, php_flag cause 500 if PHP runs via php-fpm (not as Apache module). Also error occurs with mod_rewrite with incorrect rules.

Check: temporarily rename .htaccess. If works — problem in directives. Remove php_value/php_flag and move settings to php.ini or pool config.

4. MySQL/MariaDB crash.

Bitrix returns 500 on inability to connect to DB (if error page not configured). Check service status: systemctl status mysql. Common cause — OOM-killer killed mysqld process.

In Bitrix log: DB query error. In MySQL log: InnoDB: Fatal error: cannot allocate memory. Solution: configure innodb_buffer_pool_size appropriately to available RAM, add swap, or migrate to server with sufficient memory.

5. Errors in components and templates.

If 500 occurs on specific page — problem in component. Typical causes:

  • result_modifier.php calls non-existent method after module update
  • Component template accesses $arResult['PROPERTIES']['DELETED_PROP']
  • Component uses CIBlockElement::GetList() with incorrect filter causing MySQL error

For isolation: replace component template content with <?php print_r($arResult);?>. If page works — error in template.

Preventive Measures

  • Configure exception_handling in .settings.php with file logging — even on partial kernel initialization this increases chances of getting stack trace.
  • Monitor memory_limit with margin — if average hit consumes 180 MB at 256 MB limit, any spike causes 500.
  • Separate cron processes and web processes into different php-fpm pools with different memory_limit — import with 1 GB limit won't affect normal hits.
  • Test updates on site copy. Command php /bitrix/modules/main/tools/update_system.php allows updating from CLI, simplifying rollback.