Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Umask and images folder

Started by Muut Archive 10 years ago · 8 replies · 607 views
10 years ago

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.

10 years ago

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

10 years ago

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?

10 years ago

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

10 years ago

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.

10 years ago

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

10 years ago

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.

10 years ago

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:

TXT
umask(002);

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.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago