Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 mysql errors return as HTTP 500
#1

I have multiple Mysql databases that I connect to using CI4.
If there is a connection error (like timeout in my case) - I get 500 error. Whatever I do I cannot catch that error.
Connection object doesn't return FALSE or NULL like it used to do 
Code:
$connection = \Config\Database::connect($custom_db);

Rather - it fails with 500 error
I tried setting db config to debug true/false. I tried switching environment between production/development. I tried many try/catch options w/o success.

Finally I resorted to using PHP PDO to check on a connection.

If there is no DB connection - since I cannot check if there is a connection - CI4 fails with error 500 during query
Reply
#2

Check your CodeIgniter log files, and get the Exception name.
And try/catch the Exception.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB