Web lists-archives.com

[PHP] Identical setups writing/not writing E_PARSE to error_log




Howdy,

We are looking for insight into what might cause two identical setups to treat E_PARSE differently. It is as if error_reporting, display_errors, display_startup_errors, and log_errors (in main php.ini and reflected in phpinfo()) are in effect on one and ignored on the other.

Both servers:
* are the same OS and architecture
* have the same PHPs, extensions
* have the same php.ini (which phpinfo() reflects is actually in effect)
 * on both: error_reporting is E_ALL, log_errors is On, display_startup_errors on or off does’t change anything
* All 5.x and 7.x behave consistently on a given machine
* we simplify by calling the syntactically incorrect script via the binary in a shell (i.e. no web server setup weirdness)
* each path involved has no php.ini or .user.ini (or .htaccess FTM)
* `error_log(…)` will write to $CWD/error_log ok

On server A:
1. a syntax error gets written to $CWD/error_log
2. Is out put if display_errors is On
3. via CGI is a 500
4. via CLI exits unclean

On Server B:
1. a syntax error does not get written to $CWD/error_log
2. Is not output when display_errors is On
3. via CGI is a 200
4. via CLI exits clean

Here it is in action as boiled down as we can get:

Server where it is logged:

```
# wc -l error_log;/usr/bin/php-cgi syn.php;echo $?;wc -l error_log
wc: error_log: No such file or directory
Status: 500 Internal Server Error
Content-type: text/html; charset=UTF-8

255
1 error_log
# wc -l error_log;/usr/bin/php syn.php;echo $?;wc -l error_log
1 error_log
255
2 error_log
# 
```

Server where it is not logged:

```
# wc -l error_log;/usr/bin/php-cgi syn.php;echo $?;wc -l error_log
wc: error_log: No such file or directory
Content-type: text/html; charset=UTF-8

0
wc: error_log: No such file or directory
# touch error_log
# wc -l error_log;/usr/bin/php-cgi syn.php;echo $?;wc -l error_log
0 error_log
Content-type: text/html; charset=UTF-8

0
0 error_log
# wc -l error_log;/usr/bin/php syn.php;echo $?;wc -l error_log
0 error_log
0
0 error_log
# 
```

If you have any ideas of what might cause that we’d be very grateful.

Thanks!

—
Dan

Attachment: smime.p7s
Description: S/MIME cryptographic signature