PHP 7. I'm not able to display or log errors below. Is this possible?

Viewed 81

Example 1

<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// I guess I miss a semicolon
a()
b()

Example 2

<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// I open php twice
<?php

I cannot see any error instead 500 status code is triggered. error.log is also empty. I'm not sure what kind of errors is this: parse, syntax? How do I display or log an error in such case? This bothers me for a long time now.
System info is very typical. phpinfo()

PHP Version 7.4.25
Apache/2.4.51 (Unix)
display_errors on
display_startup_errors on

edit: tested php-5.6 and php-8.1 seems the same. I can see logs PHP Parse error: syntax error, unexpected 'b' (T_STRING) on VPS, but shared hosting doesn't log them...
solution: duplicated question explains why errors are not being shown. for me there's an issue with hoster's error.log.

0 Answers
Related