Validate DB Connection (User)


i want to validate the user/password from the config file for the database connection.
if they are wrong or whatever (so no database connection can be created), i want to redirect.

but how can i validate the connection without running into a slim error ?


Make sure that your database connection handler throws an Exception if the connection fails. Then you could use a try/catch block to handle the database connection errors.

That’s not working

the database connection is done by the slim framework. but even is i create an own connection handler, the slim error handler is overtaking control and try/catch is not working.

i have “replaced” / overwritten the slim error handler and can catch PDO-Exceptions.

but if the user enters new database credentials … how can i evaluate them against the database server ?