Re: Re: mkdir in safe-mode
| From: | Peter Janett | Date: | Mon, 05 Aug 2002 21:46:53 +0000 |
| Subject: | Re: Re: mkdir in safe-mode | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111262@lists.php.net to get a copy of this message | ||
Here's my understanding based on experience, which is only that, so don't
take this a proven fact or anything. :)
Lets assume Apache is running as user Apache. You are user websiteowner.
When you FTP into the server and create a directory, that directory is owned
by user websiteowner. User Apache can read that directory (or really files
in that directory), as user Apache has read only access to those files, but
it can't write those files, because Apache does not have write access. (I'm
skipping execute permissions for now).
IN other words, PHP runs as user Apache, and you ask it to create a
directory in a folder owned by websiteowner. Since Apache doesn't have
write access, it can't create that directory (it lacks write access.)
I think that's really the bottom line, and what you need to know.
The assumption made in this post is that a php script owned by websiteowner
will run as websiteowner, which is not correct. Any php script run will run
as Apache, regardless or who owns it. (This is where executable permission
come in.)
All this assumes that php is running as an Apache DSO, not cgi. If php is
run as a cgi instead of a DSO, and SuExe is used with Apache, then the PHP
scripts can run as separate users.
HTH,
Peter Janett
New Media One Web Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PostgreSQL coming soon!
http://www.newmediaone.net
webmaster@newmediaone.net
(303)828-9882
----- Original Message -----
From: "Joel Boonstra" <jboonstra@gospelcom.net>
To: "Kai" <eisbrenner@gidn.de>
Cc: <php-general@lists.php.net>
Sent: Monday, August 05, 2002 2:17 PM
Subject: [PHP] Re: mkdir in safe-mode
> > sorry, my english isn't the best.
> >
> > I have a problem to dynamically create directorystructures using
> > php 4.2.2 running as modul in safe-mode.
> >
> > the ftp- and apache user (for the virtual-hosts) are identical, but the
> > user, the apache-daemon
> > in runnung under, is a different, so that directory-access ist only
> > possible to the owner.
> >
> > if now using the mkdir-function, php creates a directory owned by the
> > user, the apache-daemon is
> > started with, not by the user, the virtual-host is running under.
> >
> > the first directory can be created, if the permissions are the to. but
> > in the created directory i
> > can't create other directories or files.
>
> I, too, have noticed this same problem. Correct me if I'm wrong, but
> shouldn't PHP running under safe_mode create directories and files to be
> owned by the same owner as the currently-running PHP script? If my
> webserver runs as user 'apache', but safe_mode is enabled, and a script
> owned by user 'joel' creates a directory in my home directory, the
> directory is still owned by 'apache', rather than 'joel'.
>
> This seems to be misbehavior, since, as Kai pointed out, creating files
> within that directory won't work, since the safe_mode user ('joel')
> doesn't have permissions to create files in a directory owned by user
> 'apache', even though joel just created the directory with PHP!
>
> Any help on how to get around this, or fix it?
>
> --
> [ joel boonstra | jboonstra@gospelcom.net ]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>