Jump to content

chmod/mkdir setting wrong file permissions


robembra

Recommended Posts

Hi,

 

I have a script that reads through a dir and checks the file permissions but i cant seem to set them correctly. I am using the code below:

$perms = substr(sprintf('%o', fileperms($file)), -4);
chmod($new_folder_path, $perms);

 

Say a file is 0755 it will make it 431 or something and then I cant read the dir at all. I have tried all sorts playing with the format of the variable but im just going backwards.

 

$perms = 0755 and is numeric

 

I thinks its something to do with octdel's but I dont understand them :(

 

Thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.