dtgj8529 2012-05-09 08: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-10 04: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条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?