Chmod: Operation not permitted

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
morris520
Forum Commoner
Posts: 60
Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK

Chmod: Operation not permitted

Post by morris520 »

Hi I've got a problem with chmod func and couldn't get it work...

under root folder:
Ive got a.php, b.php
Im trying to use a.php to set permission mode for b.php

Code: Select all

 
<?php chmod("/b.php", 0777); ?>
 
I'm using LINX apach. and some chmod function run ok on the other file, which I used to set permission after creating an image file on the server.

So I ve got a few attempts:
1 - would it be the reason that I'm not the owner?
2 - safemode is off already, so this shouldn't be the cause.
3 - why some other functions can work? Do I miss anything?


Thanks for help folks
M
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Chmod: Operation not permitted

Post by Eric! »

Check to see who is the owner, is one case you're the owner, in the other with the image it is the apache process. And the chmod is coming from the apache process too...which is probably why it works on the image copy.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Chmod: Operation not permitted

Post by jaoudestudios »

Also check that you need the forward slash (/) at the beginning before b.php, you might need to use full path /var/www/vhost/*DOMAIN*/....
Post Reply