B
B
BarneyGumble2021-02-03 18:28:36
PHP
BarneyGumble, 2021-02-03 18:28:36

How to enable PHP error output in Bitrix VM?

1. I create an error.php file in the root of the site with the following content:

<?php
echo show_me_error;
?>

2. I open site.ru/error.php in browser - white screen

3. I watch bitrix/php_interface/dbconn.php :
$DBDebug = true;

4. I watch bitrix/php_interface/.settings.php :
...
  array (
    'value' => 
    array (
      'debug' => true,
      'handled_errors_types' => E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE & ~E_DEPRECATED,
      'exception_errors_types' => E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_USER_WARNING & ~E_USER_NOTICE & ~E_COMPILE_WARNING,
      'ignore_silence' => true,
      'assertion_throws_exception' => false,
      'assertion_error_type' => 256,
      'log' => array (
        'settings' => array (
        'file' => 'bitrix/modules/error.log',
        'log_size' => 1000000,
        ),
      ),  
    ),
    'readonly' => false,
  ),
...


5. I look at bitrix/modules/error.log - a bunch of left Warnings, but my error is not in my error.php
6. I go to .htaccess :
php_value display_errors 1
php_value error_reporting 7


7. I go to /var/log/nginx/error.log on the server - the same thing, nothing about my error

How can I see my error on the screen when opening error.php ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nokimaro, 2021-02-03
@BarneyGumble

<?php
ini_set('display_errors', 1);
error_reporting(-1);

echo show_me_error;

php_value error_reporting 7

7it is E_ERROR | E_WARNING | E_PARSEwith this setting, notices are not displayed,
we change accordingly in .htaccess to
php_value error_reporting -1
Bonus for review
https://www.php.net/manual/en/errorfunc.constants.php
https://www.php.net/manual /ru/function.error-repor...
ps I'm not familiar with Bitrix, but from the code I've seen, I don't think it's worth turning on the display of notices, because you can drown.
upd. & ~E_NOTICE literally means don't print notice level errors

A
Alexey Emelyanov, 2021-02-03
@babarun

Enable error reporting in the admin panel in the settings of the main module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question