Umask and images folder

I’m using a shared hosting provider and am having trouble with the images folder. When I go to clear the cache from the terminal, I can’t because the image cache is wholly owned by the web user. I tried setting the twig.umask_fix in the system.yaml and it didn’t change anything (as I suspected it wouldn’t). I also just went to the top of index.php and added umask(2); just to see, and that didn’t affect anything either. What can I do to make these files delete-able by my main account? Base permissions on these folders is drwxrwxr-x me web images.

Does nobody else have this problem?

Have you tried adding a PHP umask setting in setup.php?

I’m in a shared hosting environment where I don’t have direct access to core files. They’re maintained and updated by the provider. Is there an override protocol? Is there a reason why adding the umask at the top of index.php didn’t work?

Well that should work, but would be lost with any updates. Adding to a setup.php will not be overwritten.

I’m not a PHP native. Can I put a setup.php in the root folder? Or is there another place PHP will look? Apparently you can change some php settings in htaccess, but I’m not sure what the name would be. I’ll keep googling setup.php.

There is no setup.php anywhere in my accessible folders.

OK. I determined that if I put a setup.php in my root folder, it executes. But umask(2); doesn’t change anything. What’s odd is that I don’t see a umask command anywhere meaningful in the source code, and I don’t have this problem with the other cache folders. It’s just the images folder.

Correct, setup.php is an optional file that can be used to set things up, and is commonly used to set streams for multisite. But it can be used for other things. Root folder is where it should go (as you’ve found out).

There is no umask currently anywhere because the best approach is usually to let things get created with default settings. Forcing a setup, usually causes problems. That said, sometimes you need to use some force to get things setup correctly.

it makes more sense to leave the leading zeros:


This should create folders with 775 and files with 664.

You still need to make sure your user is in the web group, so it has that group read/write access.