Changing chmod for files


#1

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.


#2

Example:

<?php [color=#0000CC]$file[/color]=myfile.php; chmod([color=#0000CC]$file[/color],0644); ?>

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

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)?


#4

Not that I’m aware.

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

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost