How do I run queue on hosting? - php

I have 7 projects working with:
QUEUE_DRIVER=database
in localhost everything working great when i open cmd and enter this
php artisan queue:work
and I uploaded it to my hosting
but I do not know how to wright cron job to do this
php artisan queue:work
my app path is public_html/faker
I found this code
/usr/bin/php /public_html/faker/artisan queue:work
but i have this error come to my email
Cron php /public_html/faker/artisan queue:work --queue=high,default
Status: 404 Not Found
Content-type: text/html; charset=UTF-8
No input file specified.
Can anyone right the code to me please?

Related

Laravel logs wont create file on storage path

I tried to run my cronjob via php artisan cronjob:call on my local machine and I want to append or create a log file in the storage path. But after the cron is finished. There is no file created in the folder. I already php artisan storage:link but still not working. Did i miss something?
My command in kernel.php
$schedule->command('amazon:getTransportContent')->weekly()->appendOutputTo(storage_path('logs/getTransportContent.log'));
My cronjob output in cmd, I used print statement in printing.
D:\admin>php artisan amazon:getTransportContent
Running Cron for getTransportContentWed, Mar 3, 2021 4:50 AM
Cron finished Wed, Mar 3, 2021 4:50 AM
But there isnt no file.
Edit: tried using mkdir but still not working
$schedule->command('amazon:getTransportContent')->weekly()->appendOutputTo(mkdir(storage_path('logs/getTransportContent.log')))
Can you try this:
$schedule->command('amazon:getTransportContent')->weekly()
->appendOutputTo('storage/logs/getTransportContent.log'));

Laravel jobs (database) do not execute handle

I have a problem with laravel jobs.
I configured laravel jobs to work with the database and it is working.
When I execute a job, the entry is created in database and the constructor is well executed.
However, the handle function is never executed ... and the jobs stay in the jobs table.
Someone already had this problem?
(I use Laravel 5.7).
I found the problem...
I'm using a different queue name that the default and in config/queue.php, in the database array you have the default queue name set to "default".
So when i execute : php artisan queue:work , he is waiting for default queue.
When i execute the command line : php artisan queue:work --queue QUEUENAME it is working !
Thanks everybody.
You should listen to the queue for default
php artisan queue:work
or
php artisan queue:work --sleep=1 --tries=5 --timeout=60
If you are not using the default queue then mention the custom queue
php artisan queue:work --sleep=1 --tries=5 --timeout=60 --queue customQueue

Laravel 5 Cron Job On Godaddy Hosting

Hello and thanks in advance,
I am using Laravel 5 hosted on Godaddy. I am trying to get a cron job to run but I keep getting this message:
Status: 404 Not Found
X-Powered-By: PHP/7.1.11
Content-type: text/html; charset=UTF-8
No input file specified.
I haven't done a cron myself in Laravel before and I decided to follow this tutorial https://scotch.io/#Kidalikevin/how-to-set-up-cron-job-in-laravel
Everything works fine when I run php artisan DeleteInActiveUsers:deleteusers but the Cron doesn't.
Below are the commands I have tried in the Cron, the file name I created based on the tut is called DumpZohoContacts.php.
Note: I have added /usr/bin/php & -q but it still doesn't work I also ran app_path(); to see my app path and check that. And the code is not the issue since it runs fine by itself
Cron Commands:
php /home/[hidden]/public_html/rms/artisan schedule:run
php /home/[hidden]/public_html/artisan schedule:run
php /home/[hidden]/public_html/rms/artisan zohoDumpToDb:dumpContacts
php /home/[hidden]/public_html/artisan zohoDumpToDb:dumpContacts
php /home/[hidden]/public_html/rms/app/Console/Commands/artisan schedule:run
php /home/[hidden]/public_html/rms/app/Console/Commands/artisan zohoDumpToDb:dumpContacts
php /home/[hidden]/public_html/rms/app/Console/Commands/DumpZohoContacts.php
From my Email, I used to get this warning. Iff you have entered an incorrect command
PHP Warning: Module 'magickwand' already loaded in Unknown on line 0
Status: 404 Not Found
X-Powered-By: PHP/5.6.37
Content-type: text/html; charset=UTF-8
No input file specified.
If you are about to schedule the command as once a day (i.e., 00:00) the same time should be reflected in a $schedule->command(); object
In Kernel.php you should specify
/**
* Define the application's command schedule.
*
* #param \Illuminate\Console\Scheduling\Schedule $schedule
* #return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('SyncAPIOrders:orders')
->timezone('Asia/Kolkata')
->dailyAt('00:00');
}
You should add the command from the cPanel server as
/usr/local/bin/php /home/xyz/public_html/artisan schedule:run 1>> /home/xyz/public_html/log_laravel 2>&1
This will keep all the logs in /home/xyz/public_html/log_laravel
Running scheduled command: '/opt/cpanel/ea-php71/root/usr/bin/php' 'artisan' SyncAPIOrders:orders > '/dev/null' 2>&1

Cron Job on dreamhost server

I am trying to run a script not hosted on dreamhost control panel cron job. I have tried in 2 seperate cron jobs:
wget -q -O /dev/null http://othersite.com/api/script.php
-and-
/usr/local/php56/bin/php "http://othersite.com/api/script.php"
With the later outputting an error message:
Could not open input file: http://othersite.com/api/script.php
Any suggestions? Thank you

laravel schedule not working automatically

I am using a godaddy host. I already set the cron job command in the host php /home/site/laravel/artisan schedule:run
But the problem its returning this error for everytime it runs: [ErrorException]
Invalid argument supplied for foreach()
X-Powered-By: PHP/5.5.30
Content-type: text/html
Also it runs if i use the same artisan command in the ssh
Ok. I found the answer i had to use the command with the full path to the php like this: /usr/local/bin/php /home/mysitename/laravel/artisan schedule:run

Categories