Changing chmod for files

Changing chmod for files

Posted by: 80onelove
Posted on: 2009-05-28 13:49:00

I'm using PHP fwrite to write files to a directory. Everything is being written as rw-------, but I need to give them more lenient file permissions, perhaps 022.

Any ideas on how I can enable files to be written with more lenient permissions? I can't seem to get umask to work.

Re: Changing chmod for files

Posted by: sXi
Posted on: 2009-05-28 14:09:00

Example:

<?php
$file=myfile.php;
chmod($file,0644);
?>




How To Install PHP.INI / ionCube on DreamHost

Re: Changing chmod for files

Posted by: 80onelove
Posted on: 2009-05-28 14:31:00

Thanks, this works.

But is there any way to write files to this directory where they'll automatically possess a different set of permissions (i.e., without retroactively applying chmod)?

Re: Changing chmod for files

Posted by: sXi
Posted on: 2009-05-28 14:45:00

Not that I'm aware.

You could insert the chmod($file,0644); after any fclose($handle);




How To Install PHP.INI / ionCube on DreamHost

Tags: fwritechmod