Forum Moderators: coopster

Message Too Old, No Replies

PHP and CHOWN

Warning: chown failed: Operation not permitted

         

c0nsur

4:56 pm on Aug 28, 2003 (gmt 0)

10+ Year Member



hi guys!

here again im trying to do some fun stuff :)

id like to upload a file in a folder so i would need to change the owner and mode like this


$path = popen("pwd", "r");

$thepath=fgets($path,1500);
chown(rtrim($thepath)."/", nobody);
chmod(rtrim($thepath)."/", 0777);

but it tells me :
Warning: chown failed: Operation not permitted
what should i do?

MonkeeSage

5:00 pm on Aug 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have no clue about PHP, but just a guess, try quoting "nobody" since its a string and not a numeric value or variable...just a guess.

Jordan

coopster

5:00 pm on Aug 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You need the correct authority to the object before you can perform operations on the object. TELNET or SSH to your server and CHMOD the folder to 0777, then try your script.

c0nsur

5:12 pm on Aug 28, 2003 (gmt 0)

10+ Year Member



its on an other server not mine ...for a friend

no access via ssh and i was wondering if its possible to change the owner and mode for my folder

im jammed there dunno whatta do :)

and thanks MonkeeSage for ur advice i tough it was pretty logical but it doesnt wanna work!

jatar_k

5:21 pm on Aug 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why do you need to change the owner?

Paul in South Africa

5:36 pm on Aug 28, 2003 (gmt 0)

10+ Year Member



I don't think chown() will work on remote files. As far as I know the file must be accessible via the servers filesystem.

Take it with a pinch of salt, still learning PHP.

c0nsur

5:46 pm on Aug 28, 2003 (gmt 0)

10+ Year Member



i wanted to change the owner because chmod isnt permitted so i guess its something about owner stuff

and i dont think it will work too like this but maybe theres a way? :)

Dolemite

2:37 am on Aug 29, 2003 (gmt 0)

10+ Year Member



I went through this same issue a couple weeks ago.

Ended up calling perl scripts from PHP to do the chmoding. Perl is really a much better solution for this sort of thing because it doesn't run as "nobody".