I have tried all the solutions over the internet but still i am not able to solve it.
Problem- Opencart Displaying Php/MySql Errors (which also shows the password used to connect to mysql)
When Opencart faces any problem in connecting to MySql Database or due to too many connections php is unable to connect to database a error is displayed in the following format.
Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'indiaran_admin'@'localhost' (using password: YES) in /home3/indiaran/public_html/system/database/mysqli.php on line 6
Fatal error: Uncaught exception 'ErrorException' with message 'Error: Could not make a database link' in /home3/indiaran/public_html/system/database/mysqli.php:9 Stack trace:#0 /home3/indiaran/public_html/vqmod/vqcache/vq2-system_library_db.php(13): DBMySQLi->__construct('localhost', 'indiaran_admin', 'PASSWORD', 'indiaran_db') #1 /home3/indiaran/public_html/index.php(44): DB->__construct('mysqli', 'localhost', 'indiaran_admin', 'PASSWORD', 'indiaran_db') #2 {main} thrown in /home3/indiaran/public_html/system/database/mysqli.php on line 9
Expected Solutions:- (any would do)
- Opencart Stops Displaying Any error Mysql/php
- Error is Displayed without showing my database id and password.
- Any Solution which stops displaying all the error (including the mysqli connect errors)
Solutions Tried:-
First
php.ini has
display_errors = Off;
error_reporting = 0;
htaccess has
php_value error_reporting 0
Second
There is a setting within the OpenCart dashboard that allows you to turn on (or off) error reporting and logging.
Log into your dashboard
In the menu, go to "System" and select "Settings"
In the list of stores, click "Edit" for your store
Click the "Server" tab.
Scroll down, and there's two settings:
a. Log Errors - set this as desired
b. Display Errors - set this to "No"
Third
Commenting Out set_error_handler('error_handler'); in index.php
Fourth
Using Php Try-Catch Phrase, which i dont know exactly how to use in opencart.
Hope i am able to explain myself and someone would be able to helpme.
PS:- My Website is Hosted with Hostgator as a Shared Hosting.
Links to Similar problems which were unable to solve my problem.
http://stackoverflow.com/questions/16935473/cant-disable-error-reporting-in-opencart-php
http://stackoverflow.com/questions/5040048/php-mysql-too-many-connections-to-database-error
http://stackoverflow.com/questions/25957024/warning-mysqlimysqli-mysqli-mysqli-08004-1040-too-many-connections-in
http://stackoverflow.com/questions/28591394/mysqli-connect-error-shows-password/28591455#28591455