How to set up cache with PHP (file system perms)

software development


I am installing OpenPhoto (a PHP program) and am trying to configure its cache directory.

If the cache directory is not set to 0755, then Apache cannot serve the files in the cache directory. However, I would prefer to use tighter permissions.

What’s the best way to approach this problem?

– jeff


I’m unsure why it would seemingly require 755.

You could try adding a highly restrictive .htaccess file in the cache directory if you wanted to.

Order Allow,Deny Deny from All


If you need to serve files from the directory, it needs to be set to something like 755 (and not have a restrictive .htaccess).


cache 700 with restrictive .htaccess has worked flawlessly on DreamHost (for me) since day one.

You might need to take a look at how OpenPhoto is handling the cached files.


OpenPhoto places the cached files in a directory which is accessed directly by Apache (and not via the PHP scripts). Settings perms to 700 causes failure, which I assume is because Apache can’t access the directory (makes sense if the Apache process is running under some uid that is different than mine).


Have you tried 750 ?