Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

russellxu's avatar

Cron job does not run, and have no logs

I want cron to run php artisan schedule:run for me every minute.This is what i do by now

1.I logged in with user root

2.I use service cron start to start cron service.

3.Then I use cron -e to add a new job * * * * * cd /var/www/html && php artisan schedule:run

4.Run service cron restart to restart the servcie.

5.And nothing happened. Job is not running, no logs, nothing.

6.Then I try to add a job * * * * * /bin/echo "cron works" >> /tmp/file, so now I have 2 jobs.The job * * * * * /bin/echo "cron works" >> /tmp/file works fine. but artisan command still not working.

7.So I think maybe artisan script have some problem while running, I run cd /var/www/html && php artisan schedule:run on the command line, and it works on the command line

8.Then I think maybe is the file permission problem, I run chmod +x /var/www/html/artisan. Still not working.

Here is my Kernel.php file:

    protected function schedule(Schedule $schedule){
        $schedule->call(function(){
            Log::debug('schedule is running');
        })->everyMinute();
    }

After five hours attempts, I finally give up. Which part did I do wrong.

0 likes
4 replies
Snapey's avatar
Snapey
Best Answer
Level 122

not necessarily your issue, but you should run cron under the same user account as your webserver

so if your webserver uses www-data account then create cron with

sudo crontab -e -u www-data

otherwise you can end up with log file ownership issues

russellxu's avatar

I finnally use php artisan shedule:work to work around with this...Still have no clue what's going on with cron.

Please or to participate in this conversation.