Laravel cron not shooting on the given time - laravel

Hello Laravel cronjob is not shooting with the time give in following code
$schedule->command('snippets:newsletter')
->dailyAt('16:00')->runInBackground();
But when I am running this command it's going perfect
$schedule->command('snippets:newsletter')
->everyMinute()->runInBackground();

I think changing app time zone UTC in .env may resolve the issue
APP_TIMEZONE=UTC
then
PHP artisan config:clear

Ensure you have added an entry into your local system's crontab and that it is working correctly as described at https://laravel.com/docs/master/scheduling#introduction .

Related

Laravel Cron Job not running over ubuntu server

I have a laravel application setup over Ubuntu server using Nginx. Here I have the cron jobs. I was facing an issue, that the server was not automatically picking up changes on Jobs Files. So I googled the things, and found a command from this article which I ran;
php artisan queue:restart
Since I have run this command, now no job is running even. I am also trying with simple HeartbeatJob to log info but it is also not working. When I do php artisan schedule:run,
no error in particular just screen output as:
[2021-09-11T08:41:32+00:00] Running scheduled command: App\Jobs\Heartbeat
But nothing happens. Any idea what this queue command has done wrong and how I make my jobs working again?
Your cron job will need the absolute path to artisan, so should look something like :
php /home/user/site.com/artisan queue:restart
You may also need to specify the queue with :
php /home/user/site.com/artisan queue:restart --queue=nameofqueue

laravel vapor schedule job not running as scheduled

I have setup a laravel vapor as per documentation. Everything is working fine except scheduler.
I have set few artisan commands at certain intervals. But commands are not running as per schedule. If i run command manually it works. Seems like artisan schedule:run is not running and hence commands are not fired on defined time.
I checked lamda cli logs, no errors found. What do i check?
I fixed the issue adding below line in vapor.yml
scheduler: true
This was happening to me but in my case it was solved by composer dump-autoload.

Laravel Serve command does not respect --env parameter

To be able to run Browser tests directly in my IDE (without using the artisan dusk command), I want to run php artisan serve --env=dusk.local. While it indeed starts the local PHP server, it uses the wrong database. It uses the database specified in .env not the one in .env.dusk.local.
I ran php artisan cache:clear thousands of times, but it doesn't change anything.
Running things like php artisan migrate --env=... works.
Is there a way to achieve my goal without needing to rename my .env.dusk.local file to .env before each test?
This is a bug in Laravel 5.8: https://github.com/laravel/framework/issues/27828
There is currently no solution (other than downgrading to Laravel 5.7).
It has been fixed in the latest release 5.8.7.

Refreshing again and again shows error message

I was playing with Laravel by refreshing the page 10 times in a second and did this many times continuously. I got the below error
The only supported ciphers are AES-128-CBC and AES-256-CBC with the
correct key lengths.
This is a test case which can occur anytime by end user also. Is there any way to fix it?
I already have key in my env file. This issue occurs only when i refresh the page again and again,
I already checked the answer but could not help
As posted by one of the users at this issue at GitHub,
Under a heavy load of requests, two async requests are made, and during the second request the .env file is locked, so you receive the error only for that request.
To solve this, you can create a cache using below command, which will bypass your .env file on further requests.
php artisan config:cache
Run following command from application folder:
$ php artisan key:generate
First make the key if doesn't exists by running following command.
php artisan key:generate
Next clear your config cache.
php artisan config:clear
Propably application cached your config without app-key.

Laravel 5: Decryption error The Mac is invalid

When i try to login the following error produced:
DecryptException in BaseEncrypter.php line 49:
The MAC is invalid.
I am using xampp with php 7.
The laravel version that i use is 5.2.
*I have change the api key running php artisan key:generate.
**I have trying the following commands: php artisan cache:clear composer dump-autoload composer update with no lucky.
I have clear the history of the browser.
** Here are the values of some variables:
iv=a69g/gRfyCNWTaKeuZ2Kkw==
value=C7DfTHbFWfZq0km633uXMX0ZRd1fuzcFFBgP0vtZj/d4C4Z3btgeFlmU2a1C9TdUlUDof4mnoGhdvEeB/gL1TQ==
mac=c0460e4ea3d724631cf4a12b7b19a5e512ecec8f492b4754e183714cc9d0a05c
Any help would be usefull.
Thanks in advance.
I know this is a little late but it might be useful for future me or someone else.
I had an issue where I had to encrypt something in the database, changed the APP_KEY and then tried to decrypt it and this error happened.
It was an error on redis server.
Hope that someone will help.
There might be some issue with the .env file as I am having the same problem.
There should be space between APP_KEY and APP_DEBUG
I could find a solution I tried everything including regenerating. However, this worked for me... If you have an existing app_key (in another folder/locally) you may want to restore, you can update it in the .env file manually. Locate the APP_KEY entry in the file and replace the value with the key in your initial .env in your previous project

Resources