douyijin7741 2019-06-24 03:28
浏览 60

Cron作业没有运行特定的PHP文件

I have two PHP cron jobs running. In one cron job, am trying to open a file and write some data into it which works fine.

But in the other file, I have added an error_log() statement which is not getting printed into the log file. But the error_log file is getting updated when i manually run this php file. What could be the problem here that it doesn't write to the error_log.txt file only for cron job cases. [Note: The error_log.txt gets updated when i run the php file manually ]

Working cron:

<?php

$fp = fopen('/home/victor/public_html/victor_php/test/test.txt', 'a');
fwrite($fp, '    Cron test job   ');
fclose($fp);

?>

Not Working cron:

<?php

error_log("Cron1 test job",0);

?>
  • 写回答

1条回答 默认 最新

  • douluan5738 2019-06-24 05:06
    关注

    I just found that the error_log given in my cron job was logging into the error_log of root directory. When we run the php file manually the logs get logged into the error_log file in the current directory, and this is not the case with cron jobs. That was the confusion.

    Thank you all for the support guys.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料