homepage Welcome to WebmasterWorld Guest from 54.161.240.10
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Permissions and PHP
Any way around it?
ahmedtheking




msg:3345461
 3:22 pm on May 21, 2007 (gmt 0)

This post is quite broad so apologise if this is the wrong place. A client of mine has an Xserve (mac web server) running PHP 5 and Apache and so on. Now, he has placed for additional RAID drives for extra storage. When he uploads files to those drives as the logged in user via AFP, PHP can't read it because the files are under a different group to PHP's. Now, when I upload files as root, PHP can read and execute those files.

Is there a way to allow PHP to read those files that the root uploaded or do I have to run a CHGRP before PHP can touch those files? Is there a setting I can change or to regroup PHP?

 

wheel




msg:3345545
 4:56 pm on May 21, 2007 (gmt 0)

When you say 'php can't read the files', that seems like one of two possibilities. Either it's not a permission's problem (doubt it) or it's not php that's the problem - it's the user who's executing the php program. Small clarification, but important.

if you're uploading the files as apache, and php is running from an apache process it seems like they would be the same user (both apache) so permissions shouldn't be an issue.

Anyway, that's a lot of vagueness to say that I think you need to set apache and whatever user is running the php program to be the same 'group'. Look at the users, not the files or the programs.

(the other alternative is that the ftp program that's doing the uploading isn't setting the permissions correctly - I think this would be changed through settings in the ftp program).

ahmedtheking




msg:3345906
 10:13 pm on May 21, 2007 (gmt 0)

Well PHP and Apache are in the same 'WWW' group. It's that the user is uploading as the actual root computer user. It's weird. Even though the web sites are uploaded by the same user, it seems that PHP reports that there's a perms problem when it tries to read them. Would it be worth adding the root using into the WWW group? Or is that a huge NONO?

wheel




msg:3346922
 9:58 pm on May 22, 2007 (gmt 0)

The user shouldn't be uploading as root. What I would probably try next is setting up a user in the same group as apache then using that user to upload.

Actually, that's not what I would try next. What I would do is have the user upload via something like ftp or similiar, where the program doing the uploading has the correct permissions.

ahmedtheking




msg:3346928
 10:03 pm on May 22, 2007 (gmt 0)

Yeah that's what I did and it's all working now.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved