Welcome Guest, Not a member yet? Register   Sign In
Run a seeder using a php script, without spark CLI
#9

(This post was last modified: 04-30-2022, 05:22 PM by datamweb.)

(04-29-2022, 05:44 AM)Kishan Anand Wrote: Hi datamweb, thanks for your support on this! I followed your instructions and it is now showing this error:
ErrorException #64

CodeIgniter\Autoloader\Autoloader::main(): Failed opening required '/var/www/html/index.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear')
SYSTEMPATH/Commands/Server/rewrite.php at line 43
Code:
36 // then let the request handle it like normal.
37 if ($uri !== '/' && (is_file($path) || is_dir($path))) {
38     return false;
39 }
40
41 // Otherwise, we'll load the index file and let
42 // the framework handle the request from here.
43 require_once $fcpath . 'index.php';
44 // @codeCoverageIgnoreEnd
45

The KishanSeeder.php file is exactly how you wrote it, Routes.php is updated with your code also and there is no migration file.
I tried calling home, Home home.php, Home.php from the URL.
Thanks! Smile

This problem is due to incorrect adjustment DOCUMENT_ROOT.
To go to CPanel , select Domains.
Then click the Manage button in front of the your domain name.
then change the Document Root: to yoursitename.ir/public
Then button Update.
See yoursitename.ir Or yoursitename.ir/home Or yoursitename.ir/home/index now.
Everything is working fine.The data enters the table without any problems.

Or:The second method: use the method described in @kenjis .
Just use command
Code:
$seeder = \Config\Database::seeder();
$seeder->call('KishanSeeder');
instead of command('dbConfusedeed KishanSeeder').

Thanks so much for the @kenjis tips here. The right solution(#5943) is provided by him.
Reply


Messages In This Thread
RE: Run a seeder using a php script, without spark CLI - by datamweb - 04-30-2022, 05:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB