We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.8.13. Outputting and logging PHP errors

PHP errors can display directly on the site or commit them to the log for further analysis.

Depending on the internal structure of the site and the type of problem encountered, the output or logging of PHP errors may not always help to identify the causes of problems on the site. In some cases, it may be more useful to enable debugging mode using the tools of the site itself (as, for example, in WordPress, Joomla!, PrestaShop) or manual addition of debugging directives by a developer or a specialized specialist to his code, allowing you to track at what stage and for what reason an error occurs.

The PHP parameter is responsible for the types of displayed errors error_reporting.

To customize error output, do the following:

  1. Openup PHP settings.
  2. Opposite "error_reporting»Check the boxes next to the required values:
  3. Save your changes.
  4. Wait approximately 10-15 minutes for the changes to take effect.

PHP error logging can be done in different ways - both by means of hosting and at the level of site scripts.

To set up PHP error logging, do the following:
  1. Turnon PHP error outputby checking the boxes opposite the required error types.
  2. At the bottom of the page with PHP settings check the box next to “Enabling error_log" and press "Save»:
  3. Wait approximately 10-15 minutes for the changes to take effect.
  4. Reproduce the error on the site and check the entries in PHP error log.
If you need to capture PHP errors in a separate file, this can be done at the level of the scripts themselves. For example, add the following code at the beginning of the very first script to run:
ini_set("log_errors", 1);
ini_set("error_log", "/path/to/logu/php-error.log");

As a result, if a PHP error occurs during the operation of this script, it will be written to the log at the specified path.