Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > PHP
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 05-01-2008, 01:48 PM   #1 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 120
metazai is on a distinguished road
PHP and ownership

Trying to understand something about a LAMP site I'm working on -- slightly related to my last post but a new issue.

How do you determine ownership of a file or directory when it's created using PHP? Is it fixed to the method, or can a specific owner be assigned? Case in point:

My CMS creates directories and files, depending on what's being done. According to a list from the host, the things created have an owner name of httpd:httpd, while the thing that have just been ftp's have an ownername of the domain name, so for privacy purposes I'll just call it domainname:domainname. So now I can't delete, edit, or change permissions unless I write a script to do it, and it gets even worse. They moved the site to another server, and now I can't even seem to do that, I guess because I'm coming from yet another owner name on the new server. DOes the host have to straighten this out? I know there's a chown() function but I don't know much about it except that you have to be a superuser to use it.

Any thoughts?
__________________
metazai is offline   Reply With Quote
Old 05-01-2008, 03:48 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,114
Belisarius is on a distinguished road
The file is owned by whomever is running the PHP process. If it's created via the web, it's owned by whomever the (in your case) Apache process is running as. That would seem to be httpd:httpd.

The hoster needs to straighten it out. Most hosters allow you to process HTTP request as your user, and if your files got messed up as a result of a move, that's definitely the hoster's screwup.

What you want is something called suexec. It has to be setup by the hoster and will allow anything being run from your account to be run as you.
__________________
GitS
Belisarius is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 09:59 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle