php check chmod permissions for folder
13,452
Solution 1
did you try chmod() .
EDIT:Then try fileperms
Solution 2
Check out is_writable och is_readable. They're tailored for exactly this.
Author by
Alex Emilov
Updated on June 22, 2022Comments
-
Alex Emilov almost 2 years
Hello how can I check if a folder has permissions to be writable and readable via php.
I want to check for permissions for include and file_get/put_contents, too.
I'm creating test code to check for permissions.
-
Alex Emilov about 13 yearsI don't want to change them, I want to check if folder has this permissions.
-
Alex Emilov about 13 yearsOk, what about include and file_get_contents.I don't know which php.ini setting is for them.For them I need only the setting, then I will use ini_get.
-
Alex Emilov about 13 yearsThanks about that. I've tried it, but on windows my permissions are buggy and it didn't work, now its fine on linux.
-
Emil Vikström about 13 yearsYou do not change file permissions in php.ini. You change them using chmod as the owner of the files (FTP, SSH and even PHP have a chmod command). You can read more about file permissions and how to set them correctly here: catcode.com/teachmod