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.

Share:
13,452
Alex Emilov
Author by

Alex Emilov

Updated on June 22, 2022

Comments

  • Alex Emilov
    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
    Alex Emilov about 13 years
    I don't want to change them, I want to check if folder has this permissions.
  • Alex Emilov
    Alex Emilov about 13 years
    Ok, 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
    Alex Emilov about 13 years
    Thanks 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
    Emil Vikström about 13 years
    You 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