PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Nov 19, 2019 6:29 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: php permissions
PostPosted: Fri Sep 23, 2011 2:20 pm 
Offline
Forum Newbie

Joined: Tue Nov 14, 2006 6:57 pm
Posts: 15
Hey all,
I may have posted this in the wrong section at first...

I'm having a bit of a problem trying to set up a custom php script.
Here's what's going on:
I have an upload script that allows registered users to upload files to a temp /upload/ directory.
Upon review from admins the files need to be copied to another folder.
At first I had a problem with open_basedir restrictions but after fixing that with a vhost.conf file I was able to bypass that.
My real issue now is not so much about php itself but rather related to linux permissions.
I get a permission denied when trying to copy the files and it's my understanding that apache/php does not have permission to write to the destination folder.
In theory I think I know what needs to be done I just don't have the skills to pull this off, so any help is welcomed.

Here's what I'm thinking.
PHP needs write permission to the destination folder.

I've tried the following.
Switched php from running as an apache module to fastcgi...
The /destination/ folder is owned by user: 'domainadmin' (created by plesk when the domain is set up initially) and group: 'psacln'
the php script is owned by the same: domainadmin | psacln
when loading the script i get --> Permission denied

I chmodded the /dest/ folder to 777 and tried it again.

The file gets copied fine now but it is owned by apache | apache

Shouldn't fastcgi make all php scripts run as the 'domainadmin' ??? and not needing any higher perm than 755??

Lastly I need the domain admin account to be able to see those copied files via FTP.
Please be as detailed as possible. I'm a big noob but willing to learn fast

Setup is dedicated box running RHEL + Plesk

I've been trying to make this work for over a week now. I'm tired, confused and can't figure out what needs to be done.
Any help is greatly appreciated.

c


Top
 Profile  
 
 Post subject: Re: php permissions
PostPosted: Fri Sep 23, 2011 3:00 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
The uploaded files should be owned by the web server because PHP runs within it as a module. You can set the permissions when you upload the file to something more permissive, or put the domainadmin account in the apache group so you only need group permissions.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: php permissions
PostPosted: Fri Sep 23, 2011 4:46 pm 
Offline
Forum Newbie

Joined: Tue Nov 14, 2006 6:57 pm
Posts: 15
Hey chris,
thanks for taking the time to post.
I'm still a bit confused though.
Isn't the whole idea of running php as fascgi to make php scripts run as the domainadmin and not as an apache module?
Or are you just saying I should drop that idea and continue to use it as an apache module and add the domain admin to the apache group?
Are there any security issues in doing that?
And will this work with 755 permissions?
Sorry to ask such noobish questions I just want to make sure I get it right...

c


Top
 Profile  
 
 Post subject: Re: php permissions
PostPosted: Sat Sep 24, 2011 8:16 pm 
Offline
Forum Contributor

Joined: Sun Sep 09, 2007 6:27 pm
Posts: 282
Look into suexec maybe.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group