Welcome Guest, Not a member yet? Register   Sign In
No such file or directory when running seeder from CLI
#1

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 CLI Tool - Version 4.0.0-rc.3 - Server-Time: 2020-01-02 12:23:01pm


No such file or directory
/Applications/MAMP/htdocs/xxxxxx/system/Database/MySQLi/Connection.php - 225
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#2

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.
Reply
#3

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! ***/
Reply
#4

Your CLI version of PHP doesn’t necessarily have the same extensions installed. Run php -m and make sure MySQL extension is enabled.
Reply
#5

(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! ***/
Reply
#6

(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.

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

in my case I have UBUNTU and execute: 
Code:
sudo apt-get install php7.3-sqlite3
Reply




Theme © iAndrew 2016 - Forum software by © MyBB