3 months ago

scheduled tasks In laravel 5.7 app triggered at wrong time

Posted 3 months ago by mstdmstd

Hallo, In laravel 5.7 app I have a problem that scheduled tasks with email sending are recieved at wrong time. in my ubuntu 16 under Digital Ocean Server in crontab with command :

crontab -e

I added line :

* * * * * cd /var/www/html/the-box-booking && php artisan schedule:run >> /dev/null 2>&1

php in browser shows next :

PHP Version
date/time support   enabled
timelib version 2016.05
"Olson" Timezone Database Version   0.system
Timezone Database   internal
Default timezone    Asia/Dubai
Directive   Local Value Master Value

date.default_latitude        31.7667     31.7667
date.default_longitude       35.2333     35.2333
date.sunrise_zenith          90.583333   90.583333
date.sunset_zenith           90.583333   90.583333
date.timezone                Asia/Dubai  Asia/Dubai

I suppose that console command use cli configurations. I check in command line :

 php -v
PHP (cli) (built: May  5 2018 04:55:21) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache, Copyright (c) 1999-2018, by Zend Technologies

I open /etc/php/7.1/cli/php.ini and see:

[Date] ; Defines the default timezone used by the date functions ; date.timezone = Asia/Dubai Timezone = Asia/Dubai

I set "timezone" of app/config.php :

    'timezone' => 'Asia/Dubai',

In bootstrap/app.php I added line :


In app/Console/Kernel.php I added line :

    protected function schedule(Schedule $schedule)
        \Log::info( 'report:available-spaces-by-zones Report run # ' . time()  );

as a result I see a lot of info lines in my logs, but time of report sent if different. Today I recieved it at 21 pm.

I restarted cron, apache and OS.

Where error and how to fix it?


Please sign in or create an account to participate in this conversation.