|
Posted by Michael Vilain on 08/22/05 02:36
In article <1124654100.421269.172230@z14g2000cwz.googlegroups.com>,
jonathanmcdougall@gmail.com wrote:
> I have read many posts on this subject and found no satisfying answer.
>
> I am creating a file on the server via a PHP script. The file is
> created using GD (imagejpeg()), though I don't think it is specific to
> GD.
>
> Here is what I understand so far:
> 1) a PHP script runs in the webserver user space. In my case, this is
> 'apache', though I think 'nobody' is quite frequent also.
> 2) creating a file from the script makes the "current" user its owner;
> in this
> case, it is also 'apache'
> 3) for a reason I don't get, this file will get a permission rx-------
> 4) using ftp solves the problem
>
> Now, this is a problem to me. I need to create a file which will have
> the same owner as if I uploaded it by ftp. IIUC, I cannot use GD with
> ftp. More generally, I would prefer to avoir ftp.
>
> The server is running in safe mode, it may cause additional problems I
> am not aware of.
>
> chmod and chown are disabled.
>
> Therefore, I need a way to create a file (specifically with GD) which
> *I* will own, as if I uploaded it by ftp.
>
> This is getting quite urgent so a quick answer would be appreciated,
> though I understand my time is not more valuable than yours.
>
> Thank you,
>
>
> Jonathan
I run a web site on my ISP's shared host under Apache with mod_php and
mod_perl. As you've found, any files created by php in this way are
owned by the Apache user, "apache" in your case. There's currently now
way to avoid this under this security model nor would I imagine my ISP's
admins allowing it.
But they saw the need for web developers to create files owned by the
user, so they installed cgiwrap (http://cgiwrap.sourceforge.net/) to
allow cgi programs to run in the context of the user. They don't offer
php as a cgi language, so I wrote want I needed in perl. Works just
fine.
If you don't have these options or your web server can't be configured
this way, you'll have to "roll your own" server and manage it yourself.
More expensive, but you then become a Unix admin as well as a web
developer. There are Linux web-server ISPs that offer this service.
I'm sure someone will chime in with some suggestions.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
[Back to original message]
|