2011-04-14 06:06 阅读 36


I get the below error when I run my scrip from cron

Warning: filesize() [function.filesize]: stat failed for /home2/sharingi/public_html/scrape/zip/dailydose/ in /home2/sharingi/public_html/scrape/zip/zip.php

However if I run the script from my browser it works fine. Some kind of a permissions problem?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    dougang6821 dougang6821 2011-04-14 06:14

    It's probably an issue related to the user that your cron process runs under. Make sure that whatever cron runs as has permissions, since it's probably not the same user as your ssh account or the webserver account. You can probably figure out which user cron runs as by configuring cron to run the command whoami and email you the output.

    If you can't figure out how to make that work, you might try configuring cron to wget the public url that you know works. Don't forget to turn off the file saving, and set it to quiet mode, otherwise you'll get a lot of garbage from each run.

    点赞 评论 复制链接分享
  • duanqiao1926 duanqiao1926 2011-04-14 06:21

    if you're in a shared hosting environment, your cron job is probably running as your own user, so unless you yourself don't have read permissions for the file in question, I imagine that's probably not the issue.

    As a probable work-around, in case you can't get to the bottom of it easily, here's a function which should allow you to get the info you need without using the php-builtin.

    点赞 评论 复制链接分享