You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jochen Kächelin <jk...@linux.amsjk.de> on 2002/10/29 00:31:38 UTC

[users@httpd] allowing and denying PHP for VirtualHosts

I use Apache 2.0.43 and php as module.
How can I allow or deny PHP-Scripts for each VirtualHost?

-- 
Jochen Kaechelin


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Re[2]: [users@httpd] allowing and denying PHP for VirtualHosts

Posted by Amadej Bukorovic <ap...@minet.si>.
Argh I was looking at that but couldn`t find it so I presumed it`s non
existant :D
That would be the easyest/best way yes.

> -----Original Message-----
> From: Rasmus Lerdorf [mailto:rasmus@apache.org]
> Sent: Wednesday, October 30, 2002 11:02 AM
> To: Amadej Bukorovic
> Cc: users@httpd.apache.org; jk@linux.amsjk.de
> Subject: RE: Re[2]: [users@httpd] allowing and denying PHP for
> VirtualHosts
> 
> This is what the 'engine' directive is for.  It is only valid in the
main
> httpd.conf so it cannot be overridden in .htaccess files.
> 
> In your virtualhost block just add:
> 
>   php_admin_flag engine Off
> 
> To turn php off for that particular virtual host.
> 
> -Rasmus
> 
> On Wed, 30 Oct 2002, Amadej Bukorovic wrote:
> 
> > Hello,
> > Guess I owe you an apology. I didn't check it and I use static
modules
> > and
> > Have them enabled at all virtual hosts. I just presumed (got to stop
> > doing that) that you may load/unload DSO modules in Virtual Hosts
(which
> > would make it logical :D). I've done some rethinking and well.. as
far
> > as I see
> > It the only way of doing it is this:
> > Don't add the AddType directive for php files into your main server
> > config. Instead just add it to the virtual hosts you want PHP to be
> > enabled for.
> > And as far as the rest are concerned just make sure you don't allow
> > FileInfo override! That way no they wont have a handler for PHP and
> > won't be able to set a handler for it via .htaccess and everything
> > should work fine..
> >
> > Hope I was more helpful this time,
> > Amadej.
> >
> >
> >
> > > -----Original Message-----
> > > From: Jochen Kächelin [mailto:jk@linux.amsjk.de]
> > > Sent: Tuesday, October 29, 2002 10:46 PM
> > > To: users@httpd.apache.org
> > > Subject: Re[2]: [users@httpd] allowing and denying PHP for
> > VirtualHosts
> > >
> > > AB> Then just add something like this:
> > > AB> LoadModule php4_module modules_folder/libphp4.so
> > > AB> AddModule mod_php4.c
> > > AB> <IfModule mod_php4.c>
> > > AB> AddType application/x-httpd-php .php4 .php3 .phtml .php
> > > AB> AddType application/x-httpd-php-source .phps
> > > AB> </IfModule>
> > > AB> to all the virtual hosts you want PHP to be enabled for and
leave
> > it
> > > out
> > > AB> from the rest.
> > >
> > > Ok,  <IfModule>  is  allowed  in a VirtualHost-Container,
LoadModule
> > > not! Is it just a trick the way you described, or is this a
> > > "official" way to do it - like a big ISP?
> > >
> > > Is there not problem why I configure it like you said?
> > >
> > > --
> > > Jochen Kaechelin
> > >
> > >
> > >
---------------------------------------------------------------------
> > > The official User-To-User support forum of the Apache HTTP Server
> > Project.
> > > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> >
---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Re[2]: [users@httpd] allowing and denying PHP for VirtualHosts

Posted by Rasmus Lerdorf <ra...@apache.org>.
This is what the 'engine' directive is for.  It is only valid in the main
httpd.conf so it cannot be overridden in .htaccess files.

In your virtualhost block just add:

  php_admin_flag engine Off

To turn php off for that particular virtual host.

-Rasmus

On Wed, 30 Oct 2002, Amadej Bukorovic wrote:

> Hello,
> Guess I owe you an apology. I didn't check it and I use static modules
> and
> Have them enabled at all virtual hosts. I just presumed (got to stop
> doing that) that you may load/unload DSO modules in Virtual Hosts (which
> would make it logical :D). I've done some rethinking and well.. as far
> as I see
> It the only way of doing it is this:
> Don't add the AddType directive for php files into your main server
> config. Instead just add it to the virtual hosts you want PHP to be
> enabled for.
> And as far as the rest are concerned just make sure you don't allow
> FileInfo override! That way no they wont have a handler for PHP and
> won't be able to set a handler for it via .htaccess and everything
> should work fine..
>
> Hope I was more helpful this time,
> Amadej.
>
>
>
> > -----Original Message-----
> > From: Jochen K�chelin [mailto:jk@linux.amsjk.de]
> > Sent: Tuesday, October 29, 2002 10:46 PM
> > To: users@httpd.apache.org
> > Subject: Re[2]: [users@httpd] allowing and denying PHP for
> VirtualHosts
> >
> > AB> Then just add something like this:
> > AB> LoadModule php4_module modules_folder/libphp4.so
> > AB> AddModule mod_php4.c
> > AB> <IfModule mod_php4.c>
> > AB> AddType application/x-httpd-php .php4 .php3 .phtml .php
> > AB> AddType application/x-httpd-php-source .phps
> > AB> </IfModule>
> > AB> to all the virtual hosts you want PHP to be enabled for and leave
> it
> > out
> > AB> from the rest.
> >
> > Ok,  <IfModule>  is  allowed  in a VirtualHost-Container, LoadModule
> > not! Is it just a trick the way you described, or is this a
> > "official" way to do it - like a big ISP?
> >
> > Is there not problem why I configure it like you said?
> >
> > --
> > Jochen Kaechelin
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Re[2]: [users@httpd] allowing and denying PHP for VirtualHosts

Posted by Amadej Bukorovic <ap...@minet.si>.
Hello,
Guess I owe you an apology. I didn't check it and I use static modules
and
Have them enabled at all virtual hosts. I just presumed (got to stop
doing that) that you may load/unload DSO modules in Virtual Hosts (which
would make it logical :D). I've done some rethinking and well.. as far
as I see
It the only way of doing it is this:
Don't add the AddType directive for php files into your main server
config. Instead just add it to the virtual hosts you want PHP to be
enabled for.
And as far as the rest are concerned just make sure you don't allow
FileInfo override! That way no they wont have a handler for PHP and
won't be able to set a handler for it via .htaccess and everything
should work fine..

Hope I was more helpful this time,
Amadej.



> -----Original Message-----
> From: Jochen Kächelin [mailto:jk@linux.amsjk.de]
> Sent: Tuesday, October 29, 2002 10:46 PM
> To: users@httpd.apache.org
> Subject: Re[2]: [users@httpd] allowing and denying PHP for
VirtualHosts
> 
> AB> Then just add something like this:
> AB> LoadModule php4_module modules_folder/libphp4.so
> AB> AddModule mod_php4.c
> AB> <IfModule mod_php4.c>
> AB> AddType application/x-httpd-php .php4 .php3 .phtml .php
> AB> AddType application/x-httpd-php-source .phps
> AB> </IfModule>
> AB> to all the virtual hosts you want PHP to be enabled for and leave
it
> out
> AB> from the rest.
> 
> Ok,  <IfModule>  is  allowed  in a VirtualHost-Container, LoadModule
> not! Is it just a trick the way you described, or is this a
> "official" way to do it - like a big ISP?
> 
> Is there not problem why I configure it like you said?
> 
> --
> Jochen Kaechelin
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re[2]: [users@httpd] allowing and denying PHP for VirtualHosts

Posted by Jochen Kächelin <jk...@linux.amsjk.de>.
AB> Then just add something like this:
AB> LoadModule php4_module modules_folder/libphp4.so 
AB> AddModule mod_php4.c 
AB> <IfModule mod_php4.c> 
AB> AddType application/x-httpd-php .php4 .php3 .phtml .php 
AB> AddType application/x-httpd-php-source .phps 
AB> </IfModule>
AB> to all the virtual hosts you want PHP to be enabled for and leave it out
AB> from the rest.

Ok,  <IfModule>  is  allowed  in a VirtualHost-Container, LoadModule
not! Is it just a trick the way you described, or is this a
"official" way to do it - like a big ISP?

Is there not problem why I configure it like you said?

-- 
Jochen Kaechelin


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] allowing and denying PHP for VirtualHosts

Posted by Amadej Bukorovic <ap...@minet.si>.
Hello
The best way I`d say you could do this is to install the php module as a
DSO. Afterwoods make sure your main server config file doesn`t include
any php module directives otherwhise all the virtual hosts will just
inherit
it.
Then just add something like this:
LoadModule php4_module modules_folder/libphp4.so 
AddModule mod_php4.c 
<IfModule mod_php4.c> 
AddType application/x-httpd-php .php4 .php3 .phtml .php 
AddType application/x-httpd-php-source .phps 
</IfModule>
to all the virtual hosts you want PHP to be enabled for and leave it out
from the rest.

That should do the trick.

Regards,
Amadej.


> -----Original Message-----
> From: Jochen Kächelin [mailto:jk@linux.amsjk.de]
> Sent: Tuesday, October 29, 2002 12:32 AM
> To: users@httpd.apache.org
> Subject: [users@httpd] allowing and denying PHP for VirtualHosts
> 
> I use Apache 2.0.43 and php as module.
> How can I allow or deny PHP-Scripts for each VirtualHost?
> 
> --
> Jochen Kaechelin
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org