Page 1 of 1

problems chmoding

Posted: Sat Jan 31, 2004 6:27 am
by scriptmaster
Hi, maybe someone here can help me with this.

I am trying to chmod a file to 755 from a PHP file:

chmod('myfile.txt', 755);

I get the following error message:

Warning: chmod(): Operation not permitted
in /usr/home/macer/public_html/2/install.php on line 25

I tried this too:
chown('myfile.txt', 755);
chmod('myfile.txt', 755);

and I got:

Warning: chown(): Operation not permitted
in /usr/home/macer/public_html/2/install.php on line 24

Warning: chmod(): Operation not permitted
in /usr/home/macer/public_html/2/install.php on line 25

Can anybody help me with this?

Thanks

Posted: Sat Jan 31, 2004 7:22 am
by timvw
Who is the owner of the file that you are trying to chmod? And does the user that is running your webserversoft (traditionally user nobody or www-data) have enough rights to chmod?

Posted: Sat Jan 31, 2004 7:33 am
by scriptmaster
thanks for the reply.

i'm not sure how to find that out.
how can i check the ownership and manipulate it in order for me to do the chmod command?

Posted: Sat Jan 31, 2004 7:36 am
by timvw
- Easiest way to change permissions on a file is through a shell.

- If you don't have access to that, you could try to do it through your ftp-client, or the ftp-functions in php.

Posted: Sat Jan 31, 2004 7:37 am
by McGruff
A search before posting a question can be useful: see this

Posted: Sat Jan 31, 2004 9:07 am
by scriptmaster
i can change the permissions though FTP and shell, that is not the problem.
the problem is I can't change a permission of a file via a php file no matter what I do.

McGruff, I saw that thread before I posted :) , i did'nt find the answer to my question there

Posted: Sat Jan 31, 2004 9:51 am
by McGruff
Rgr: possibly this function was disabled by the host?