php - Cron 作业不起作用,Laravel 和 cPanel

标签 php laravel cron cpanel

出于某种原因,我不再理解我的 cron 不起作用,当我执行命令 schedule: run changes 时,服务器上没有任何反应,我将解释每个步骤,看看是否有人可以告诉我我可以做错了

这是我的命令代码

<?php 
namespace App\Console\Commands;
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Plan;
use App\Plan_negocio2;
use App\Plan_negocio;
use App\Pagina;
use DateTime;
use Illuminate\Console\Command;

//use Illuminate\Foundation\Inspiring;

class Resaltador extends Command {

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'res:resaltado';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Verificar Resaltador';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $plan=Plan_negocio::all();
        //$fechaAct=$request->fecha;

        if ($plan) 
        {
            $arrNegocio=[];
            foreach ($plan as $key => $value)
             {  
                //$value->fechafin=strtotime("2017-04-07")-time();

            date_default_timezone_set('America/Caracas');   
            $date = new DateTime($value->fechafin);
            $dateHoy=new DateTime();
            //$dat=$dateHoy->getTimestamp();
            $dat=9999999999999999;
            $value->fechafin=$date->getTimestamp();
            //$now = new DateTime();

                //$gene= $date1->format('U') - $now->format('U');


                if ($dat>$value->fechafin) 
                {
                 $negoPlan=Pagina::find($value->negocio_id);
                 $negoPlan->resalta_id=1;
                 $res=$negoPlan->save();

                }

             }
        }

    }

}

这个,内核的代码

     <?php 
        namespace App\Console;

        use Illuminate\Console\Scheduling\Schedule;
        use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

        class Kernel extends ConsoleKernel {
            /**
             * The Artisan commands provided by your application.
             *
             * @var array
             */
            protected $commands = [

                //'App\Console\Commands\Inspire',
                \App\Console\Commands\Resaltador::class,
            ];

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

                     $schedule->command('res:resaltado')->everyMinute();
        }

}

当我执行 schedule: run 命令时一切正常

databse

success

enter image description here

enter image description here

但正如我所说,当我尝试从服务器激活它时,我不明白它可能是错误的,我留下了步骤

在“loupper”文件夹中我存放了 laravel,我用 putty 获取路径并将其分配给 cpanel 中的 cron 作业管理器

enter image description here

enter image description here

我在服务器上没有 Composer ,但调查我读到没有必要,但是没有任何反应,我做错了什么?

更新: 我刚查了一下,这封邮件已经到了

/usr/local/cpanel/bin/jailshell: php/home3/pixsony6/public_html/loupper.com/loupper/artisan: No such file or directory

最佳答案

php 和 cPanel 中的路径之间缺少空格

关于php - Cron 作业不起作用,Laravel 和 cPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43372259/

相关文章:

mysql - 如果Ubuntu中没有PID(进程ID),请重新启动MySQL服务

php - 访问 PHP 关联数组,索引表示为字符串

php - 在 MAMP 上设置 Cron 作业 - InfiniteWP

javascript - 如何在不知道文件名的情况下指定下载文件夹?

php - 如何在 MySQL 中使用 DISTINCT 插入到第二个表?

php - 如何在 Laravel 中将秒数转换为天时分

cron - 将 crontab 文件存储在我的项目中

cron - 为什么Dockerfile中的cron服务不运行?

image - Intervention\Image\Exception\ImageNotWritableException 使用 Laravel 4

php - 如何在 Laravel 注销后捕获登录时间?