Cronjob not running as apache

view full story

http://serverfault.com – I have a cron job that runs a PHP script and creates files (images). But the cron job is running as me (being me my own username), not apache, nobody, httpd, www... and all the files created belongs to this user. If I run the the same script through a browser, it runs as apache. I've tested it with whoami and checked the file permissions. The problem is that if I develop an web-interface to remove files (which is how users/admin will be able to manage the images), it will run as apache and it won't be able to remove the files, as apache is not the owner nor belongs to the same group as me. (HowTos)