Jump to content

fwrite - chmod


arfa

Recommended Posts

A standard file write routine - generating the file $fname on the first run.
[code=php:0]
$fh = fopen($fname, 'w');
fwrite($fh,$data);
fclose($fh);
[/code]
On the current server the file, $fname, is written with permission and status:
-rw-r--r--  www-data
So... trying to later write to the file doesn't work.
Being www-data it resists standard fTP chmod command.
It also fails:
chmod("$fname", 0666);

Any suggestions or comments here would be most welcome.

thanks
Link to comment
https://forums.phpfreaks.com/topic/32033-fwrite-chmod/
Share on other sites

ooops, hit the post button....

rasmus/file.gif", "wb");
I am definitely not on a win server (but should get into the 'portability' habit)

via my PHP chmod script using: chmod("$fname", 0666);
I was getting:
Warning: chmod() [function.chmod]: Operation not permitted in /home/ftp/.../....../..
but now see that this is only for directories.

This thread is a bit of a space waster - other than forcing me to write out my process, and examine the various steps and presumptions along the way - AND learn as a result.
sorry about that
thanks for your tolerance
Link to comment
https://forums.phpfreaks.com/topic/32033-fwrite-chmod/#findComment-148993
Share on other sites

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.