php.ini hide notices and warnings

In my php.ini I am trying to show errors only but not warnings.  Her is some settings I have below.

display_errors = On

and

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING

But notices and warnings still show up
stargateatlantisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Those constants may or may not work.  Check this link.
http://php.net/manual/en/configuration.changes.php

See also: http://php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
What you might want to do is log errors, warnings and notices, but not show any of them to clients.  Maybe something like this:

error_reporting = 32767
display_errors = Off
log_errors = On
log_errors_max_len = 1024
error_log = error_log

If you want a script that can find the error logs, just post back and I'll put it here.
0
stargateatlantisAuthor Commented:
So this will disable show warnings
0
Ray PaseurCommented:
The php.ini settings I posted will disable browser display of all PHP messages related to Notice, Warning, and Error.  You will still be able to find the information in the error_log file, but it will not "tip your hand" to potential hackers by exposing the PHP issues.

You can also use the @ prepended to the name of a function to suppress the messages from a specific function call, but I do not recommend that - it can cause silent failures and is considered an antipractice.

If you really want to turn off Notice and Warning, but leave Error available for display, you can set this:

error_reporting = 32757
display_errors = On
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.