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 聚类分析或者python进行数据分析
  • ¥15 如何用visual studio code实现html页面
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?