PHP Ownership/Permission 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 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.

Carrie Smaha
Carrie Smaha Senior Manager Marketing Operations

Carrie enjoys working on demand generation and product marketing projects that tap into multi-touch campaign design, technical SEO, content marketing, software design, and business operations.

More Articles by Carrie

Was this article helpful? Join the conversation!