Forum Moderators: coopster

Message Too Old, No Replies

CHMODing a dir using ftp site()

dir ok, file not

         

mrnoisy

12:08 pm on Oct 10, 2006 (gmt 0)

10+ Year Member



CHMODing a dir using ftp_site() works:

ftp_site($conn, 'CHMOD 0644 /path/to/dir');

CHMODing a file using the same code doesn't work:

ftp_site($conn, 'CHMOD 0644 /path/to/dir/file.txt');

I get the error:

Warning: ftp_site() [function.ftp-site]: /path/to/dir/file.txt: Operation not permitted in /home/httpd/vhosts/file.php on line 100

I don't know why, does anyone else?

ahmedtheking

9:42 pm on Oct 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



why not just try chmod? as in: [uk2.php.net...]

mrnoisy

2:18 am on Oct 14, 2006 (gmt 0)

10+ Year Member



I had tried CHMOD and kept getting permission errors, hence the FTP approach.

What's really gets me is that it just worked: chmod("/somedir/somefile", 0644);

I'm sure it didn't work previously, for some mysterious reason, so thanks for your prompt ahmedtheking.

eelixduppy

2:21 am on Oct 14, 2006 (gmt 0)



I'm guessing you tried a different file with different permissions. It was probably a permission issue all along :)

mrnoisy

10:03 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



It's happening again!

chmod("/somedir/somefile", 0644);

Warning: chmod() [function.chmod]: Operation not permitted in /home/httpd/vhosts/example.com/httpdocs/admin/index.php on line 121

What could cause this.

cybersphere

11:01 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



ftp_chmod works fine for me, if you want to chmod via FTP. I don't know what ftp_site is supposed to do.

Tip: If you read the chmod value in from a config file, and it is of the form 0777, convert it from Octal to Decimal using octdec, prior to using as a parameter in ftp_cmod.