How do you disable warnings in PHP?

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
User avatar
exterminator
New to forums
New to forums
Posts: 12
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri Nov 16, 2012 10:29 pm

How do you disable warnings in PHP?

Post by exterminator »

Hi Friends

How do you disable warnings in PHP in the hosting?

Thanks =)
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: How do you disable warnings in PHP?

Post by Edge100x »

These should be disabled by default. Most of the time, when I see them, it's because the application reenabled them. What warning are you seeing that needs to be disabled?
User avatar
exterminator
New to forums
New to forums
Posts: 12
Joined: Fri Nov 16, 2012 10:29 pm

Re: How do you disable warnings in PHP?

Post by exterminator »

Code: Select all

Warning:  Division by zero in /usr/www/personalserver/mysite/main.php on line 70 
Warning:  Division by zero in /usr/www/personalserver/mysite/main.php on line 71
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: How do you disable warnings in PHP?

Post by Edge100x »

It would be best to fix the root cause of that (the division by zero) by editing the source. But, if you'd prefer to just hide the warning, you will need to look for where in your application it is using the error_reporting() function and comment those lines out.
User avatar
Vanderburg
Former staff
Former staff
Posts: 1253
Joined: Sat Nov 13, 2010 7:27 am
Location: Dallas, TX

Re: How do you disable warnings in PHP?

Post by Vanderburg »

I believe you can just add an @ at the beginning of a function to prevent it from spitting out an error, too, but it's not always a very good idea.
User avatar
exterminator
New to forums
New to forums
Posts: 12
Joined: Fri Nov 16, 2012 10:29 pm

Re: How do you disable warnings in PHP?

Post by exterminator »

In other host..works fine ... my friend have bluehost. ¿what is happening?
User avatar
exterminator
New to forums
New to forums
Posts: 12
Joined: Fri Nov 16, 2012 10:29 pm

Re: How do you disable warnings in PHP?

Post by exterminator »

any ideas?:(
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: How do you disable warnings in PHP?

Post by Edge100x »

Fixing the bug in the code is still the best idea. Disabling warnings through your application or .htaccess is the second-best idea.
Post Reply