I am new to Docker but set it up and pulled my Codeigniter 4 project in. Everything appeared to go smoothly until it came time to test my database. I could access my database through MySQL Workbench but my app wouldn’t recognize it. I got an error 500 - [MySQLi] file not found. Anyone else experience this issue?
That’s more like a PHP/ CodeIgniter issue. MySQLi is a PHP class library to handle MySQL connections. I don’t know why the error shows “file not found”, but the information you shared will not be enough to help you more and an error message helps only when we know where that was shown exactlyBecause of “500” I guess it is a HTTP error code with a custom error message in a web browser. Your datbase is probably fine. The PHP app connection settings could be wrong.
Thank you for your response and yes the database is fine, I put exactly the same details in on both the app and MySQL Workbench. The app spits out an error stating file not found but MySQL Workbench goes in immediately and displays the tables. I thought it might have something to do with pointing Docker to a SQL Script because I read somewhere that because the database is in a container, in order to keep data etc you need to point it to a SQL script which regenerates the database but I am going to play around today and see what I can come up with.
I’m not sure what that is supposed to mean. You definitely want to a kind of persistent storage (volume, bind mounted folder) for the database, but that has nothing to do with the application that connects to it.
I finally found the answer after many hours of frustration! The answer is as such, the reference to the DB HOST in the database connection must not point to the IP or to localhost but rather to the name that you gave the database connection in docker-compose.yml and this solved my issue. I found the answer on this thread :