Welcome! Log In Create A New Profile

Advanced

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

Posted by Dan Muey 
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
Attachments:
open | download - smime.p7s (2.1 KB)
There are usually different php.ini Giles for the CLI and the web version. Check that they are the same.

Thanks,

Bastien

> On Jan 11, 2018, at 5:28 PM, Dan Muey <[email protected]> wrote:
>
> 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thank you Bastien, the INIs are identical even across servers.

Its not a matter of CLI and CGI behaving differently its a matter of the same PHP and configuration on two boxes behaving differently. On each box CGI and CLI behave the same. I hope that clarifies :)

> On Jan 12, 2018, at 6:13 AM, Bastien Koert <[email protected]> wrote:
>
> There are usually different php.ini Giles for the CLI and the web version. Check that they are the same.
>
> Thanks,
>
> Bastien
>
>> On Jan 11, 2018, at 5:28 PM, Dan Muey <[email protected]> wrote:
>>
>> 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
Attachments:
open | download - smime.p7s (2.1 KB)
Sorry, only registered users may post in this forum.

Click here to login