User permissions Apache / PHP

AudiAddict

Verified User
Joined
Oct 10, 2008
Messages
82
I have an issue which I can't seem to solve.

One of my users is running a SSL website based on PHP and MYSQL. All the static website data is stored in his homefolder (/home/joe/domains/domainname.com/private_html/website).

All the dynamic contents which is displayed on the website is stored in the mysql database and is retrieved every 30 minutes through a php retrieve script which is run under the user account (cronjob).

Also the website saves CACHE of images in the local folder of the user folder. Now here lies the problem. The data cannot be saved here due to permission problems:

Code:
Unable to write to cache directory (./cache//image/43c/f78/6a9/25c/2fa/e77/169/006/118/4ec/c2f/6bf/4e97.jpg),  owner=root,  group=root,  User=apache,  perms= , referer:

The apache user is triggering this cache process and it obviously cannot write or read in this user folder.

How do I solve this problem without having to recode the whole website functionality? I tried manually changing the permissions to CHMOD -R 777 which only works temporarily because files, folders and sub folders are created while using the site and then cannot be accessed (or saved). Scheduling a chmod every 10 seconds is not really an option. Chowning to apache also didn't help.

How to solve this problem? Thanks!

Another question: How to schedule a cronjob under the apache user instead of the user itself? This is the current cronjob and It has been made under the useraccount joe

0 * * * * php /home/joe/domains/mydomain.nl/private_html/joe/retrieve.php >/dev/null 2>&1
 
Last edited:
How do you run PHP? If not as mod_ruid2, then I suggest that as part of the solution.

However it appears from the error that the cach directory path, or the specific cached file, may be owned by root. Is it? If so, then why? How is it created?

Jeff
 
Back
Top