Baahzera
Member
- Joined
- Apr 4, 2014
- Messages
- 74
- Solutions
- 1
- Reaction score
- 18
Hello. I've found that when MyACC fails to connect to mysql server it displays error messages leaking database user and password.
I've supressed my infos from the error.
This happens when the machine restarts. Apache starts before the mysql server, then the error with database information is displayed until the mysql server is up.
Does anyone knows how to fix this?
Hello again.
Forgot to mention that I've already set the config to production, so the errors should not be displayed.
I aparently managed to get rid of that error adding those lines to the file OTS_DB_MySQL.php at system/libs/pot.
If someone has a better solution that would be appreciated.
I've supressed my infos from the error.
Code:
ERROR: Cannot connect to MySQL database.
Possible reasons:
MySQL is not configured propertly in config.lua.
MySQL server is not running.
PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/www/.../system/libs/pot/OTS_DB_MySQL.php:139 Stack trace: #0 /var/www/.../system/libs/pot/OTS_DB_MySQL.php(139): PDO->__construct('mysql:dbname=be...', 'user', 'password', Array) #1 /var/www/.../system/libs/pot/OTS.php(374): OTS_DB_MySQL->__construct(Array) #2 /var/www/.../system/database.php(98): POT->connect(Array) #3 /var/www/.../system/init.php(125): require_once('/var/www/...') #4 /var/www/.../admin/index.php(25): require('/var/www/...') #5 {main}
This happens when the machine restarts. Apache starts before the mysql server, then the error with database information is displayed until the mysql server is up.
Does anyone knows how to fix this?
Hello again.
Forgot to mention that I've already set the config to production, so the errors should not be displayed.
I aparently managed to get rid of that error adding those lines to the file OTS_DB_MySQL.php at system/libs/pot.
Code:
try { parent::__construct('mysql:' . implode(';', $dns), $user, $password, array(
PDO::ATTR_PERSISTENT => $params['persistent']
));
} catch (PDOException $e) {
print "Could not connect to database.";
die();
}
If someone has a better solution that would be appreciated.