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

Hello, I hope somebody can help me. I'm very new to CodeIgniter and to this forum. I am currently following a tutorial by Alain Rivest - https://includebeer.com/en/blog/how-to-b...r-4-part-4 - and spent the whole day trying to run a seeder. 
Is there any way to do this without using spark from CLI? Is there a way to call a php script from the browser URL? If so, could you please show me an example of a script for doing this?
Or if anybody could provide simple instructions on how to successfully use CLI with CI on a VPS, I would really appreciate it! 
I've spent so many hours trying to use terminal through cPanel (I am on a VPS) but the PHP version is wrong on there (5.6) and the installed version on the server is 7.4. I think this is why it keeps bringing up an error: 
"Parse error: syntax error, unexpected ':', expecting '{' in /home/apex5/apex_sys/system/Common.php on line 45". 
Here is line 45 from system/Common.php (which I have not modified in any way at all)
if (! function_exists('app_timezone')) {
    /**
    * Returns the timezone the application has been set to display
    * dates in. This might be different than the timezone set
    * at the server level, as you often want to stores dates in UTC
    * and convert them on the fly for the user.
    */
    function app_timezone(): string ===> This is line 45
    {
        $config = config(App::class);

        return $config->appTimezone;
    }
}

------------------------------------------
and in App.php line 111 is this, (not modified from original)
    public $appTimezone = 'America/Chicago';
-----------------------------------------
I have tried using sudo after adding the user into the wheel group users in WHM, to try and change the php version showing in terminal but it doesn't allow permission (spent hours trying to troubleshoot this and it's made me really stressed and shaking legs!).
All I need to do is run the seeder so that I can load the database table with the sample data records and finish the tutorial. I can then get back to building my main application!
Many, many thanks in advance!
Reply


Messages In This Thread
Run a seeder using a php script, without spark CLI - by Kishan Anand - 04-28-2022, 11:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB