Re: mod_fastcgi + php
David Birnbaum <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Gasior,
It seems that you could simply run the wrapper as is. If you set up suexec for
FastCGI (see the documentation) than the seteuid/gid is already done, as is the
chdir, so you just need to chroot() and then exec. That should work fine.
David.
-----
On Wed, 26 Oct 2005, Gasior wrote:
> Hello to all
>
> I'm looking for a sollution to run php in a safe way in shared environment.
>
> Currently I use PHP as a CGI which is executed by a wrapper. This
> wrapper works like suexec (it does some checking about file permissions)
> but just before executing PHP it chroot's to VirtualHosts "filesystem".
> Every virtualhost has it's own "filesystem" for chroot purposes (/bin,
> /etc/ and all nessecary lib's and bin's).
> That approach works for me excellent, except its poor performance.
>
> My question is: is it possible to use FastCGI for executing PHP not only
> under some UID/GID (suexec does that fine), but also in specified
> chroot'ed environment (different for every VirtualHost) ?
>
> My idea is to use wrapper, that will find out for which virtualhost it
> needs to spawn PHP, that:
>
> chdir('/vhost/path');
> seteuid(UID);
> setegid(GID);
> chroot('./');
> execv();
>
> I've done some tests with FastCGI wrappers, but inside wrapper i can't
> get any informations about target virtualhost. Also setting some env
> variables inside <VirtualHost> directive doesn't work. Maybe FastCGI app
> is executed before apache process VirtualHost section ?
>
> Maybe you could point me how can i find inside the wrapper for which
> VirtualHost is this request executed.
>
> If my aproach is a lost battle, please let me know. I'll just buy better
> hardware :)
>
> Regards
> Gasior
>
>
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/