Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding waring does not work

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
0
0
DE
Dear all,

I use PHP 5.3 on an IIS. I had to copy my code from another server (which had PHP 4) to this one and I don't want to change the code as I have not enough time for it. So I'd like to hide all warning as I turned on register_globals in php.ini.

PHP shows me the following warning:
PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater

So I tried to turn off hte warnings in php.ini like this:

error_reporting = E_ERROR & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING

And after that stopped and restartet the IIS.

But it does not work. Does anybody know how to turn it off in php.ini?

Best regards,
Eva
 
the php.ini file is where you can set error reporting and the way you are doing it is fine.

however this directive can be overriden in the code and in local php.ini files and in .htaccess files and in httpd.conf files etc. in windows it can also be set in the windows registry.

search your code for error_reporting() directives.

you might also try suppressing php errors with the display_errors() directive.

better still, take the time to fix your code
 
Hi jpadie,

I tried

error_reporting(E_ERROR ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);
ini_set('display_errors', 0);

But the warning is still displayed.

Best regards,
Eva
 
Then you have something in your code or elsewhere that is overriding these directives.

also note that windows is notorious for using php.ini files that are located in bizarre places. make sure that you are editing the right file for your server instance. to test this run a phpinfo() on your server. the location of the loaded php.ini will be noted near the top of the output.
 
Hi

Eva said:
I tried

error_reporting(E_ERROR ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);
ini_set('display_errors', 0);
That is useless. That warning is generated when parsing the php.ini, long before executing your code.

But do not worry, apparently you can not stop those warnings anyway. If you turn [tt]error_reporting[/tt] completely off with this :
Code:
error_reporting = 0
You will get no error for any obviously erroneous code, but will still get the deprecation warning.

By the way, your expression looks quite strange to me. To not display that warning, it should look like one of these :
Code:
error_reporting = E_ERROR [highlight]&[/highlight] E_NOTICE [highlight]&[/highlight] E_WARNING

[gray]# or[/gray]

error_reporting = [highlight]E_ALL[/highlight] & ~E_DEPRECATED


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top