chmod() - permission denied

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
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

chmod() - permission denied

Post by Joe »

Why would I get a permission denied error when using chmod() and rename()?. I was thinking perhaps my config files are set incorrectly?.

Regards


Joe
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

If the files are owned by the USER, and not the webserver, and the permissions are not other=w, then you wont be able to.

Think of it this way:

I'm the webserver. I want to change YOUR file. Do I have permission to?

I'm not the user. I'm not in the same group. So, that means I'm "Other" or "World".
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

I set the permission of the file to 777 just to test. No luck?.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Remember, when renaming a file you are changing the content of a directory, thus this directory needs to be writeable too.

-- Scorphus
Post Reply