PHP Ownership/Permission Issues
PHP and Permission/Ownership Issues
"Bad File Descriptor" Errors in FTP
*Note that this applies to servers running mod_php only*
As PHP applications are becoming more popular, we often come across issues where users are unable to access, edit, or remove their own files or folders. The reason for this is typically due to ownership and permission issues associated with the php user, "nobody." When you install a php program such as phpNuke, phpBB, Gallery, Joomla, etc. on your website, these files are created by the php programs, and are therefore owned by this virtual php user.
Just a basic rundown on permissions:
Every file and folder on your website has an owner, a group, and a set of permissions (read, write, and execute. Also, there are three categories of user type: the owner, the group, and the "world" (meaning; everyone else). So you can basically make a file writeable by the owner, but only readable by everyone else. By "owner" I am referring to the user who created the file. When dealing with PHP and everything else on your website you would consequently be dealing with two users: you (username) and the php user ("nobody").
This means that when a php program goes through the installation process, it is creating files owned by its user, "nobody." When you access your site via FTP or File Manager, you are accessing the files are your user, which is the username that you used to log in (userna5 or such). So then when you go into FTP and try to edit files for the php program, you'll find that you don't have permission because you are not the owner; "nobody" is. On the other side, when you upload a file in FTP and try to call it from the php program, that php program may not be able to read or edit it as well because -you- are the owner.
We most often see these problems with customers who use FrontPage or Dreamweaver, as they will try to edit php files and such in these programs and then try to upload them, then realize that they can't. That's because they will try to upload into one of the php directories, where the php user "nobody" will say, "Hey, that's MY file and you can't change it!" therefore giving you a lovely "Access Denied" message.
Our solution to this is to edit your website as usual, but use the provided administrative panel from your php's software to make any changes to your php program. For instance, if you have Gallery2 installed in a subdirectory on your website, you should log into the admin panel of Gallery2 to upload or make changes, while using FTP, Frontpage, etc. to make changes to the rest of your site. If you find it absolutely necessary to be able to access your php files through FTP or vice-versa, you would need to contact us so that we can make the necessary ownership changes.
Joomla and Mambo users: There is an FTP simulator that you can use to work around the permissions issue, called Joomla/Mambo Xplorer. Check out these links: