mercredi 2 octobre 2019

Testing PDO Error Handling: How to Force a Database Connection Error?

Is there any way to force a database connection error so I can test my PHP code's error handling? We know that for PDO there's a huge risk that improper error handling can cause a full back trace to be displayed on-screen, possibly revealing the database's username and password (as warned on php.net » pdo connections).

I've been trying to intentionally force this to happen (by renaming to fictional database tables, etc.) but I haven't yet been able to get the result. Are there any other ways of simulating database problems?

I have Cpanel access on a shared host running Apache.

Aucun commentaire:

Enregistrer un commentaire