Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php artisan schedule:run not working #17156

Closed
vijaysebastian opened this issue Jan 5, 2017 · 8 comments
Closed

Php artisan schedule:run not working #17156

vijaysebastian opened this issue Jan 5, 2017 · 8 comments

Comments

@vijaysebastian
Copy link

  • Laravel Version: 5.2.45
  • PHP Version: 5.6.25
  • Database Driver & Version: Mysql Ver 14.14 Distrib 5.6.31, for osx10.6 (i386) using EditLine wrapper

I am trying Laravel schedule command to run some background process for sending mails and fetching emails. When I run these commands individually using artisan they all run, but when I try to run shcedule:run command to run these commands it shows "No scheduled commands are ready to run."

I've tried to look for an answer but nothing worked. So I tried to rectify the problem by running simple command and check the output. Below is my kernal.php

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
//use App\Model\MailJob\Condition;

class Kernel extends ConsoleKernel {

    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\Inspire::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     *
     * @return void
     */
    protected function schedule(Schedule $schedule) {
        $schedule->command('inspire')->everyMinute();
        dd($schedule);
    }

   
}

when I run schedule:run it shows this output.

BhanuSlthiasMBP:Faveo-Helpdesk-Pro-bhanu-fork vijaysebastian$ php artisan schedule:run
Illuminate\Console\Scheduling\Schedule {#54
#events: array:1 [
0 => Illuminate\Console\Scheduling\Event {#1680
+command: "'/Applications/AMPPS/php-5.5/bin/php' 'artisan' inspire"
+expression: "* * * * * *"
+timezone: null
+user: null
+environments: []
+evenInMaintenanceMode: false
+withoutOverlapping: false
+runInBackground: false
#filters: []
#rejects: []
+output: "/dev/null"
#shouldAppendOutput: false
#beforeCallbacks: []
#afterCallbacks: []
+description: null
}
]
}

But when I remove dd() in schedule() function the output is

BhanuSlthiasMBP:Faveo-Helpdesk-Pro-bhanu-fork vijaysebastian$ php artisan schedule:run
No scheduled commands are ready to run.

Please help me, I am using laravel 5.2

@sisve
Copy link
Contributor

sisve commented Jan 5, 2017

Your Laravel version is outdated, and you are using PHP 5.5 according to that path.

Is you application down for maintenance? Can you run php artisan up to disable maintenance mode and try again?

@vijaysebastian
Copy link
Author

@sisve Firstly thanks for your quick response; I have run php artisan up but still it is not working.

My Php version

Bhanu-Slathias-MacBook-Pro:Faveo-Helpdesk-Pro-bhanu-fork vijaysebastian$ php --version
PHP 5.6.25 (cli) (built: Aug 27 2016 13:55:31) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

My Laravel version

Bhanu-Slathias-MacBook-Pro:Faveo-Helpdesk-Pro-bhanu-fork vijaysebastian$ php artisan --version
Laravel Framework version 5.2.45

Laravel 5.2 supports task scheduling, so this feature should work,

@sisve
Copy link
Contributor

sisve commented Jan 5, 2017

  1. Your paste indicates that you use php from /Applications/AMPPS/php-5.5/bin/php, not the system-wide installed php.
  2. Support for Laravel 5.2 was dropped when Laravel 5.3 was released.

Next step in debugging would probably be to edit Event::isDue and see what it returns.

@vijaysebastian
Copy link
Author

@sisve you are correct, I have changed my php version; But no change

Illuminate\Console\Scheduling\Schedule {#54
  #events: array:1 [
    0 => Illuminate\Console\Scheduling\Event {#1083
      +command: "'/Applications/AMPPS/php-5.6/bin/php' 'artisan' queue:listen"
      +expression: "* * * * * *"
      +timezone: null
      +user: null
      +environments: []
      +evenInMaintenanceMode: false
      +withoutOverlapping: false
      +runInBackground: false
      #filters: []
      #rejects: []
      +output: "/dev/null"
      #shouldAppendOutput: false
      #beforeCallbacks: []
      #afterCallbacks: []
      +description: null
    }
  ]
}

@vijaysebastian
Copy link
Author

@sisve interesting thing is, If i remove .env file, it is executing ! WHY ?

@sisve
Copy link
Contributor

sisve commented Jan 5, 2017

What if you have an empty .env file? Could you remove one setting at a time from your .env file to see when it starts to work? The goal is to find out which specific configuration setting is required to reproduce the issue.

@GrahamCampbell
Copy link
Member

Sounds like this is a task for the forums until there's something that can be presented clearly in a new issue.

@wingadium1
Copy link

It seems I have same problem, too.

In my case: I use AWS elasticbeanstalk to deploy, I do not use .env file in Environment but I use Elastic Beanstalk Environment Properties to set Env variable via $_SERVER.

I modified my database.php a little bit for load DB_HOST, DB_PORT, etc from $_SERVER instead of env file
=> It works

But when I tried to implement an scheduler, It seems use .env file to get DB_HOST, DB_PORT, etc, and it failed to run scheduler.

Do you have any suggestion for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants