CHMOD not permitted


chmod(): Operation not permitted in …

A simple chmod problem. Has chmod been disabled on my server?

I’m making an application that edits files. I’ve set my server config to PHP 4 without CGI otherwise everything is fine. I’ve released my work but because I developed it under CGI mode, everything worked because everything was running under the root/cgi users.
Now users are complaining of File Permission errors because they don’t have the luxury of CGI mode. So I decided to set my domain to PHP 4 without CGI so I can have a similar environment to theirs. But now I can’t even have access to chmod…

Is this a common occurence on most servers? I’d rather not have to tell everyone to make sure all their files are 777 or 666 for it to work. I’d rather let the program do it. What other ways are there to edit local files from a PHP script if the permissions don’t initally allow editing?

EDIT: Ok. I don’t have access to system or passthru either…
I’ve got it to chmod now. I don’t know what the problem was. But it’s now changing any files it edits the owner/group to “dhapache”. Which now means my SSH or FTP can’t change the file in any way (can upload over it but owner/group remains). So I thought I could use chown() but I can’t find the original owner/group unless I can do a system command or “ls -la” which lists the owner/group of all the files.

I know this might be better in programming but it could also be a config error on my server… does anyone else have access to chmod/system commands, what is your server setup?


Only the root user can chown a file from one user to another. Also, files created by mod_php are always going to be owned by dhapache.dhapache. That’s a consequence of the apache module. You are better off using php as cgi if you want to have control over the file permissions.

  • Dallas
  • DreamHost Head Honcho/Founder