dtgj8529 2012-05-09 00:40
浏览 111
已采纳

PHP文件手动运行但在Cron Job上表现出意外

I have a dreamhost web panel and I am setting a cronjob to run my php script, but it shows weird errors, it looks like that it's not executing the file , but it's reading the file. The error is shown below, it comes as email to me

?php: No such file or directory [somesessionvariable]=1573: command not found line 3: syntax error near unexpected token "include/mydb.php"' line 3:require_once("include/mydb.php");

This is the subject of the mail:

Cron /usr/local/bin/setlock -n /tmp/cronlock.3782446772.128284 sh -c $'/path /to/file/cases_cron.php'

the permission of the file is 755 and i have copied the path from other perfectly running cronjobs, so no issue to the file path as it's getting the file contents. I am not getting where the problem is

  • 写回答

4条回答 默认 最新

  • duanbai5348 2012-05-09 20:37
    关注

    Ok, Guys, Thanks for all of your support, I am finally able to sort out the matter.

    I was missing the following line on the top of the file

    #!/usr/local/bin/php

    Adding this line at the top of the php file, sorted my problem. But i don't know that what this line means to the script. But i copied it from other working crons.

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

报告相同问题?

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

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

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

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

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

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

客服 返回
顶部