You are here: Re: PHP and cron jobs « PHP Programming Language « IT news, forums, messages
Re: PHP and cron jobs

Posted by David Haynes on 03/14/06 19:19

Matthew Augier wrote:
> Hey all
>
> I help out at a gaming website, where we play BF2 and track player
> stats/give them awards etc. I've got a whole backend and everything
> works exactly as I need... except for when I need to update the awards
> via cron job. Then I'm getting a "imagepng(): Unable to open 'xxx.png'
> for writing in XXX". All the paths are correct as it loads other images
> as part of the process, and I belive it's a permission issue. The files
> are in a 777 folder and each file has the permission of 644 (User 65534,
> grou 65534) - what am I doing wrong?
>
> (BTW tried different permissions, and if I delete the file the cron job
> creates it, but then you can't access it via a http request)
>
> Many thanks
>

As I understand it:

cron runs as the effective user id of the name of the crontab file.
e.g. if you have a crontab file named 'foo', then crontab will run as
the effective user 'foo'.

I say 'effective user' since if there are two accounts, say 'foo' and
'bar', and both have a userid of 1234 and 'bar' is located ahead of
'foo' in the /etc/passwd file, then cron will run as 'bar' even though
the crontab file is named 'foo'.

That aside, I think your issue is that the effective user cron is
running your job as is not able to write the file. (i.e. it is not
running as user 65534).

Solutions:
1. run the cron job as user 65534.
2. run the cron job and sudo to userid 65534
3. open the permissions on xxx.png to 666

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация