At some point earlier on it appears there were too many sql connections and the following was echo’d to screen for whomever was looking:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08004] [1040] Too many connections' in /dir/file.php:21
Stack trace:
#0 /dir/file.php(21): PDO->__construct('mysql:host=loca...', 'the user', 'password')
As you can see, it printed the username and password.
I’m new to PDO form of connecting to db, and I got into it because people told me my regular mysql_connect form was insecure. However by default, when mysql_connect ever had too any connections it never printed the username and password to the screen.
What a disaster.
How do I stop PDO from doing this if it error’s out??
I’m using:
$dbh = new PDO('mysql:host=localhost;dbname=' . $db, $user, $pass);
Edit your php.ini and set
If you don’t have access to php.ini then at the top of your script(s) you need to add:
See http://php.net/manual/en/errorfunc.configuration.php and http://php.net/manual/en/function.error-reporting.php
This will stop all errors from being outputted to the browser. Make sure you are still logging errors (via php.ini setting).
P.S. Do not toss away PDO