[英]Laravel 5 Cron Job On Godaddy Hosting
Hello and thanks in advance, 您好,谢谢!
I am using Laravel 5 hosted on Godaddy. 我正在使用Godaddy上托管的Laravel 5。 I am trying to get a cron job to run but I keep getting this message:
我正在尝试执行cron作业,但我一直收到以下消息:
Status: 404 Not Found X-Powered-By: PHP/7.1.11 Content-type: text/html; 状态:404找不到X-Powered-by:PHP / 7.1.11内容类型:text / html; charset=UTF-8 No input file specified.
charset = UTF-8未指定输入文件。
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 我之前从未在Laravel中做过自我诊断工作,所以我决定遵循此教程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. 当我运行php artisan DeleteInActiveUsers:deleteusers时一切正常,但Cron却没有。
Below are the commands I have tried in the Cron, the file name I created based on the tut is called DumpZohoContacts.php. 以下是我在Cron中尝试过的命令,基于该Tut创建的文件名称为DumpZohoContacts.php。
Note: I have added /usr/bin/php & -q but it still doesn't work I also ran app_path(); 注意:我已经添加了/ usr / bin / php & -q,但是它仍然无法正常运行,我还运行了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: Cron命令:
php /home/[hidden]/public_html/rms/artisan schedule:run
php / home / [hidden] / public_html / rms / artisan schedule:run
php /home/[hidden]/public_html/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 / rms / artisan zohoDumpToDb:dumpContacts
php /home/[hidden]/public_html/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 schedule:run
php /home/[hidden]/public_html/rms/app/Console/Commands/artisan zohoDumpToDb:dumpContacts
php / home / [hidden] / public_html / rms / app / Console / Commands / artisan zohoDumpToDb:dumpContacts
php /home/[hidden]/public_html/rms/app/Console/Commands/DumpZohoContacts.php
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 (ie, 00:00) the same time should be reflected in a $schedule->command();
如果您打算将命令安排为每天一次(即00:00),则应在
$schedule->command();
反映相同的时间$schedule->command();
object 宾语
In Kernel.php
you should specify 在
Kernel.php
您应指定
/**
* 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 您应该将cPanel服务器中的命令添加为
/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
这会将所有日志保留在
/home/xyz/public_html/log_laravel
Running scheduled command: '/opt/cpanel/ea-php71/root/usr/bin/php' 'artisan' SyncAPIOrders:orders > '/dev/null' 2>&1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.