No such file or directory when running seeder from CLI |
I'm trying to load some test data with a seeder file and it gives the error "No such file or directory". It looks like it's when it tries to connect to MySQL but I can't find what file it's looking for. The application works fine in the browser, so the database config is good. I looked at the code in MySQLi/Connection.php and I can't find where this exception comes from.
Any idea what file it's looking for and can't find? Code: $ php spark db:seed BlogSeeder
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
That's the try...catch block for making the actual connection with MySQLi. Is it possible you don't have MySQLi extensions available? Or the database itself? Also try removing and re-installing the framework portion (vendor, or system) in case of permissions issues.
All those things are already working when I test the app in the browser. I can create and edit new blog post. So I can confirm MySQLi is available, the database is up and running, the credentials are good. I just can't understand why from the command line it give this error. I will search the string 'No such file or directory' in all CI files to try and find where it's coming from.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Your CLI version of PHP doesn’t necessarily have the same extensions installed. Run php -m and make sure MySQL extension is enabled.
(01-11-2020, 06:05 AM)MGatner Wrote: Your CLI version of PHP doesn’t necessarily have the same extensions installed. Run php -m and make sure MySQL extension is enabled. Ha! I didn't think about that. The CLI version was not the same version of PHP. Now it work when I call the same version. Thank you! Code: /Applications/MAMP/bin/php/php7.3.8/bin/php spark db:seed BlogSeeder
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
(01-12-2020, 08:08 AM)includebeer Wrote:(01-11-2020, 06:05 AM)MGatner Wrote: Your CLI version of PHP doesn’t necessarily have the same extensions installed. Run php -m and make sure MySQL extension is enabled. in my case I have UBUNTU and execute: Code: sudo apt-get install php7.3-sqlite3 |
Welcome Guest, Not a member yet? Register Sign In |