I checked the server's settings by uploading a file with phpinfo() method in it and found that display_errors was set to 'off'. First I tried the following lines of code:
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
But it doesn't work. Then I found the solution - just two lines of code in .htaccess file, placed in the main directory of the site.
php_flag display_errors on php_value error_reporting 7