chmod() [function.chmod]: Operation not permitted !?!?!

Permalink
I had Concrete 5.2.1 migrated to a new server, everything went ok. only i get the following error when i want to delete something in the sitemap i get this error.

Warning: chmod() [function.chmod]: Operation not permitted in /root/concrete/libraries/3rdparty/adodb/adodb-csvlib.inc.php on line 303

Also while making a Index Search Engine I get this error, only without any extra info.

chmod() [function.chmod]: Operation not permitted


I made a test folder on the same server with a new installation. I had to change some things ( mostly chmod and safe mode off -> .htaccess). and everthing works fine there.

I also checked the PHPinfo() if the index search engine libraries/extention are installed. and they all are.

If you need to see the PHPinfo() information. Ask and i will provide. But i think, this is not the problem.

Does anyone else have any idea why I get this error, or did someone had this error and has te solution. Please post it here.

Thank you in advance.

View Replies:
Remo replied on at Permalink Reply
Remo
maybe safemode is on..

chmod has been discussed a few times in the past in this forum!
Sebastiaan replied on at Permalink Reply
Just checked again, but Safemode is off. What else could it be?

I'm using 2 installs in 2 different locations and with 2 different databases.

When i connect the new install to the database, the error disapears, but then index wont stop indexing, or it is in a endless loop or something like that. but that could be, because of missing blocks. I did this, to check for the chmod error.

I also made 2 PHPinfo() files, one for each directory, and compared them. and they look like the same to me ( ok, i know, its because they are on the same server etc! but i override some settings with .htaccess.)

If you want to see the 2 PHPinfo() files, let me know and i will send you the links. so you can look for yourself.

I know about other Chmod discussions in this forum. but they are mostly pointed to some directories. I get the error in the script itself. When the script tries to chmod a file or directory ( not sure anymore what it was exactly )


---------------
Here i get the error:
if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) {
         $ok = fwrite( $fd, $contents );
         fclose($fd);
         chmod($filename,0644);  //<-- error line 303
      }else {
         fclose($fd);
         if ($debug)ADOConnection::outp( " Failed acquiring lock for $filename<br>\n");
         $ok = false;
      }
Sebastiaan replied on at Permalink Reply
While migrating the files from server A to server B, copy the files to you hard disc and then back to another server. the following folders, in the files folder/ :
avatars
cache
onstates
thumbnails
trash

is apache the owner, but because i copied (using ftp) from my hard disc to the server, i became the new user, so apache was not allowed to access that directory anymore!

Can anyone comfirm this?
katz515 replied on at Permalink Reply
katz515
Did you move to VPS server?

I always have the same problem when I moved from my shared testing server to VPS hosting.

You need a SSh root access and do chown and chgrp to those directories and folders.
wltr replied on at Permalink Reply
wltr
Did you try "Clear cache" in "Sitewide settings > Debug"?

It is correct that the rights to the cache files need to belong to the web server. Just allowing write access to all doesn't seem to work. katz515's suggestion should do the trick, if clearing the cache doesn't help.
Sebastiaan replied on at Permalink Reply
I migrated the site from Server A to my computer. For all files and folders i became the new owner. After moving it from my computer to Server B, the domain-user became the owner of all files and folders. I do not now where i can change the owner, but with a fresh install, installing al the additional blocks and using the old database. almost everything worked. I only had to use a copy() function to copy any thumbnails form a temp folder to the thumbnails folder in files. After that, everything work fine.
TheRealSean replied on at Permalink Reply
TheRealSean
Another possible solution for anyone who encounters this problem

You could use Putty or similar ssh to connect to your server and you should be able to change the permissions via command line,

in Putty its a case of going to the directory

in our case cd /site_path/c5/
ls -l (lists the folders and files and their permissions)
chown -R apache:apache * (be very carefull if you do this you do not want to do it at the root level you will recursively)
chown changes the group
-R means recursively from our current location
name:group - we change the group from apache
* all files/folders




I would quite like to be able to change the group that Concrete installs as not to keen on it being in group Apache, as that allows access to more of our sites. We have a limited group that apache is a member of so we tend to change the group.

This can also cause the Unable to add file to directory permissions problem that I have seen floating around in the forum (how I arrived here).