dongmeiyi2266 2016-03-17 09: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 14: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条)

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持