0

I want set up own error_log without some error types over htaccess.

Like this: error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED

error_reporting = E_ALL(32767) & ~E_NOTICE(8) & ~E_WARNING(2) & ~E_DEPRECATED(8192)

So it should be php_value error_reporting 24565 (32767-8-2-8192=24565)

But I still get PHP Warning. What I'm doing wrong?

Here is a full code:

php_flag display_startup_errors off

php_flag display_errors off

php_flag html_errors off

php_flag log_errors on

php_value error_log /path/log/error_log.log

php_value error_reporting 24565

1
  • What happens if you add var_dump(ini_get('error_reporting')); above the line where the warning is displayed? Does it equal 24565? Commented Nov 8, 2021 at 14:30

1 Answer 1

2

Although it is impossible to check the php code since it is not provided, here are a few things you can do.

Test the following script:

test.php

error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);

var_dump(ini_get('error_reporting'));
trigger_error("Test", E_WARNING);

Run php test.php. The output should be: string(5) "24565", without any warning displayed.

Test if .htaccess values are accepted

Include this in your .htaccess file:

php_value error_reporting 24565

Now test if the value is accepted by PHP:

test.php

var_dump(ini_get('error_reporting'));
trigger_error("Test", E_WARNING);

Run with php test.php. It should output string(5) "24565", no warning displayed.

Check to see if error_reporting gets overwritten somewhere in your PHP code:

Look for the following functions:

ini_set('error_reporting', /* some value */);
error_reporting(/* some value */);
Sign up to request clarification or add additional context in comments.

4 Comments

First test return string(5) "24565" Second test return string(5) "24567"
the second returns 24567? Instead of 24565?
> the second returns 24567? Instead of 24565? yes Thank you very much! I think some server configuration could overwrite it. I will search for that.
that could mean .htaccess it not enabled, or at least php_value is not accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.