dongmeiyi2266 2016-03-17 01:00
浏览 137
已采纳

无法通过cron运行artisan命令[laravel 5.2]

I am trying to run an artisan command from a cron task but I keep getting errors.

In Plesk I have created this task:

php /var/www/vhosts/domainxxx.co.uk/httpdocs/artisan schedule:run 

I'm trying to run a queue

However I get an error

Could not open input file: php /var/www/vhosts/domainxxx.co.uk/httpdocs/artisan schedule:run

if I run the command php artisan schedule:run from the httpdocs directory it works.

I've tried loads of combinations of the path and full path to php but nothing seems to work.

What am I doing wrong?

Fiddling about I created a test script in the httpdocs called crontest.php which just echoed out a status. I'm able to get this running with cron using this command:

 /usr/bin/php /var/www/vhosts/domainxxx.co.uk/httpdocs/crontest.php

The log I get shows as the domain user rather than the root user - don't know if this makes a difference? I can see the test output in the notification I receive.

Switching this to:

/usr/bin/php /var/www/vhosts/domainxxx.co.uk/httpdocs/artisan schedule:run 1

I get the error:

/usr/bin/php: No such file or directory

Confused - does this error relate to php or artisan (assume artisan as it works for the tst script). Can anyone help please. Artisan is definately there :(

  • 写回答

2条回答 默认 最新

  • dousuowu4610 2016-03-19 06:27
    关注

    After plenty of searching and trial and error the issue related to the "system user" SSH settings for the domain.

    I managed to created the task successfully in the root users cron ("system wide"). This worked so after plenty of digging had to set SSH access for the user the cron jobs were being run under - assumed already had access

    Once set the files and folders became accessible and the cron jobs now run successfully - phew!

    Thanks for your help ROn Brouwers

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部