Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MitchelBrayon's avatar

Task scheduling in laravel forge

I've hosted my app in Digital Ocean with Laravel Forge and have created a artisan command to run through schedule [Nightly].

The artisan command runs smoothly via terminal but returns No such file or directory while running it through Scheduled Jobsmanually from Laravel Forge.

The command for the job is:

php /home/forge/sitename.com/artisan Instagram:fetch

The artisan command php /home/forge/sitename.com/artisan Inspire i.e php artisan inspire returns the correct output.

While the above mentioned custom artisan returns No such file or directory

app\Console\Commands\FetchInstagram.php's handel method:

public function handle()

{ $instagram = new Instagram('api-key'); $posts = $instagram->media(); //gets 20 latest insta posts of a user // dd($posts); $fromDBs = Insta::orderBy('id', 'desc')->take(20)->get(); //get last 20 rows from table foreach( $posts as $post) { Insta::firstOrCreate([ 'thumb_link' => $post->images->thumbnail->url , 'standard_link' => $post->images->standard_resolution->url , 'caption' => $post->caption->text ]); } } Code from Kernel.php:

protected $commands = [ 'App\Console\Commands\FetchInstagram' ];

protected function schedule(Schedule $schedule) { $schedule->command('Instagram:fetch') ->daily(); }

0 likes
1 reply

Please or to participate in this conversation.