Search code examples
phpmysqlcodeignitercodeigniter-4

Looking for more info about why I cannot connect with database Codeigniter 4


I made a small tool using Codeigniter 4 on my local machine in windows env with XAMPP.

I created a MySQL database in a server, pulled the code, and applied the appropriate configs but when I try to use parts of the tool that involve databases I get:

CodeIgniter\Database\Exceptions\DatabaseException #8
Unable to connect to the database.

The exception seems to be trow by BaseConnection.php at line 395

392             // We still don't have a connection?
393             if (! $this->connID)
394             {
395                 throw new DatabaseException('Unable to connect to the database.');
396             }

I added a .env setting the environment to development so I can see the error messages.

My server is a shared server running PHP 8.0 with the following enabled modules

I also run a small script in the server but outside to Codeigniter to test password, username, port, and address and it is working fine.

Any help and tips to better understand what is happening or how to found out will be very appreciated.


Solution

  • You can check the writable/log folder and will have a more detailed log.