开发者

filesize function fails when run from cron

开发者 https://www.devze.com 2023-02-25 16:06 出处:网络
I get the below error when I run my scrip from cron Warning:filesize() [function.filesize]: stat failed for /home2/sharin开发者_如何学Gogi/public_html/scrape/zip/dailydose/April_14_2011.zip in /hom

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

Warning: filesize() [function.filesize]: stat failed for /home2/sharin开发者_如何学Gogi/public_html/scrape/zip/dailydose/April_14_2011.zip 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号