Hi!
I'm using various CMSs on my server and since I don't know PHP coding and also don't have the time to modify the scripts, I'm searching for an easy way to disable the MySQL errors. I'm talking about the errors that show in browser whenever the database table is corrupted or the script cannot access the database for some reason (mysql not running, wrong password/username etc.)
I'm hoping a simple trick with htaccess or php.ini exists, though I haven't found anything yet.
So, any ideas on this?
Thank you!

But they are off

Emm.. Are you sure ? It works for me! Anyways, If that doesn't do the trick, try with error_reporting in php.ini .

error_reporting = ~E_ALL & ~E_NOTICE

This will not let any error/warning or notice to be displayed on the screen.

Emm.. Are you sure ? It works for me! Anyways, If that doesn't do the trick, try with error_reporting in php.ini .

error_reporting = ~E_ALL & ~E_NOTICE

This will not let any error/warning or notice to be displayed on the screen.

Still not working. I have, for example, a phpbb2 still showing:

phpBB : Critical Error
Could not connect to the database

and an E107 showing:

CRITICAL_ERROR:
Line : generic, class2.php
Error reported as: [6]: Unable to form a valid connection to mySQL. Please check that your e107_config.php contains the correct information.

Is there a way to redirect, at least, visitors to another page if there's a MySQL error?! Actually this would be even better then hiding errors.
Thanks !

Actually, These are not mysql errors. These are user defined errors [ie., phpbb defined errors].
I haven't worked on phpBB. So, I can't tell you how phpBB handles errors. But, to hide the errors from phpBB, you can go to common.php , comment the line

set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');

and use this instead [or just comment the line].

set_error_handler(PHPBB_MSG_HANDLER);

And of course, you should set display_errors to off. This worked for me.


P.S. I am not aware of e107. But, I am sure, there will be something similar. Look at the config files and see how the error is handled.

Cheers,
Naveen

Actually, These are not mysql errors. These are user defined errors [ie., phpbb defined errors].
I haven't worked on phpBB. So, I can't tell you how phpBB handles errors. But, to hide the errors from phpBB, you can go to common.php , comment the line

set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');

and use this instead [or just comment the line].

set_error_handler(PHPBB_MSG_HANDLER);

And of course, you should set display_errors to off. This worked for me.


P.S. I am not aware of e107. But, I am sure, there will be something similar. Look at the config files and see how the error is handled.

Cheers,
Naveen

I don't have that line and not even "set_error_handler" in the common.php file. Anyway, thanks for pointing me to the right path. I'll ask the CMS forums support, probably someone there will know. I was hoping is a simple (one click :)) way to do it server wide.
Thanks again!

Okay.. Lets hope someone here know the answer.
Anyway, Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.