Htaccess can't read 0600 files


#1

Hi all -

I am using PHP APC caching function with Zend Framework. The actual caching works great but I’m having trouble with htaccess being able to check if the cached file exists. APC caches everything as permission 0600 and uses the below Mod Rewrite to check if the cached file exists.

RewriteCond %{REQUEST_METHOD} GET RewriteCond /home/user/example.com/cache/%{REQUEST_URI}\.html -f RewriteRule .* cache/%{REQUEST_URI}\.html [L]

It seems that Apache/Mod Rewrite can NOT access the file do to permissions being set at 0600. If I manually change the permissions to 0644 the Mod Rewrite works just fine (I would like to keep the permissions at 0600 if possible).

I’ve never had this problem before and was wondering if someone could shed some light on how Dreamhost manages things like the Apache user.

Thanks!


#2

Who owns the cache’d html files? Is it the same user account?


#3

Yes - all processing/reading/writing is under the same user account.

Thanks!


#4

Can you see the cached pages if you hit them up directly in your browser? I’m tossing things at the velcro wall right now, while I’m trying to see if I can reproduce this…


#5

Thanks for taking the time to trouble shoot with me Ipstenu-DH.

When the file is set at 0600 I get 403 Forbidden in the browser.

When set to 0644 the page displays fine in the browser.
[hr]
Also, PHP files run fine in the browser when set to 0600. Just not the static HTML cached files.


#6

This behavior is as expected. Apache runs as a web server user (dhapache), so if an HTML file is set as 0600, Apache cannot read it.


#7

Thanks for the info Andrew F.

I wonder why the default on Zend_Cache APC is to set the files as 0600.