problems chmoding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scriptmaster
Forum Newbie
Posts: 20
Joined: Wed May 21, 2003 8:26 pm

problems chmoding

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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?
scriptmaster
Forum Newbie
Posts: 20
Joined: Wed May 21, 2003 8:26 pm

Post 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?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

A search before posting a question can be useful: see this
scriptmaster
Forum Newbie
Posts: 20
Joined: Wed May 21, 2003 8:26 pm

Post 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
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Rgr: possibly this function was disabled by the host?
Post Reply