PHP Upload File Permissions On AFS

A common problem (as a quick search shows) when creating a file upload script in PHP is the permissions on the destination directory. The PHP engine must have permissions to write a file to the destination directory. For Linux and Unix file system, the standard way is to use CHMOD; but, the method is different if the file system is AFS which I have seen the most use by colleges such as UMBC. Here’s how I went about fixing it:

The error message:
Warning: move_upload_file(): Unable to move "(src)" to "(destination)" in (php file path) on line NNN

The fix:
I had to give permissions to add files (i) to the destination directory to the user that PHP is running as. I found the user for PHP by looking at user’s on the directory PHP is located in: “fs listacl”. I found PHP by running php_info() and seeing where many of the file paths share in location. Most of the file paths are the same up till the last directory so use the common part of the different paths. I found PHP to be located at (common path)/bin.

> cd (common path)/bin
> fs listacl
Access list for . is
Normal rights:
(the-php-user) rl
system:administrators rlidwka

Since I knew the user wasn’t system:administrators it had to be the other user.

Going back to the parent directory of the destination directory for my file upload, I set permission for the-php-user:
> cd ~/www/
> fs sa (desination directory) (the-php-user) rlidwka

This may not be complete but I hope it helps.

Comments

    The comments to the post “PHP Upload File Permissions On AFS.”
    Comment Said When Edit

    Nice layout, but that guy on the left is _really_ irritating!

    Said: Aaron When: 8:34 am, January 24th, 2008

    Leave a Reply

    All comments are moderated for approval after submission. Attention spammers do not waste your or my time by trying to comment.

    Your Personal Information
    Author Name .
    Email Address .
    Website Address .
    Your Comment
    Send Your Reply