![]() |
Hi all,
I'd like to "unload" Database because I don't need it and, most of all, I don't want to use a local db just to avoid the "db connection error" at the bootstrap. I'm using CodeIgniter 4. Many thanks, Maui
Where did you load database?
(12-16-2021, 09:50 PM)kenjis Wrote: Where did you load database? it's hard to say because in CI3 I used to load libraries in the autoload.php file: Code: $autoload['libraries'] = array('database', 'session', 'email'); But in CI4 (which I'm using now for the first time) the autoload.php file is slightly different and only contains the following lines (I cut the comments out): Code: <?php I don't know exactly where the database is loaded (but it is, because everything works fine if I define an access in the .env file or in the /app/Config/Database.php)
The connection to the database is made on the first request to the database.
Don't want to connect? Do not make inquiries into it. In CI3, autoloading meant pre-linking libraries. In order not to be distracted by initialization while the application is running. (12-18-2021, 05:33 AM)iRedds Wrote: The connection to the database is made on the first request to the database. This helped me solving the problem: the database was loaded in a model. I removed all the queries and now I don't get any connection error if the db is not reachable. Thank you very muchs! |
Welcome Guest, Not a member yet? Register Sign In |