You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Axel Gallus <Ax...@profindis.de> on 2010/11/07 23:49:51 UTC

[users@httpd] Override main server conf

Hello, 

I use apache in a virtual host environment.....

My main server is configured with

LoadModule php5_module	modules/libphp5.so
AddType	application/x-httpd-php		.php
AddType	application/x-httpd-php-source	.phps
DirectoryIndex	index.html index.htm index.shtml index.php index.php3 index.cgi
AddHandler	cgi-script	.cgi

so that only *.cgi files get executed via interpreter in my vhost-documentroot.

I also want the *.php files to be executed as cgi, so I added 
AddHandler	cgi-script	.cgi .php
to my perosnal vhost-config-section

However, it seems that the main server config dominates the cgi-script *.php config.
Is there a way to also treat .php files as cgi scripts in my virtualhost under
this circumstances, how?

Thx and regards

A.Gallus







Re: [users@httpd] Override main server conf

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 10 Nov 2010 20:18:35 +0100
"Axel Gallus" <Ax...@profindis.de> wrote:

> Can you explain why mixing those directives is a problem?
> Is there a workaround?

AddType for things that aren't types (like cgi or php) is a
grotty hack from the very early days.  It's been wrong since
AddHandler was introduced in Apache 1.1 (1996).

-- 
Nick Kew

---------------------------------------------------------------------
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


AW: AW: [users@httpd] Override main server conf

Posted by Axel Gallus <Ax...@profindis.de>.
I succeeded by removing the mod_php5 mimme type via 
"RemoveType .php".
After that I could register my own mod_cgi handler via "AddHandler cgi-script .php".

Thx for your input.

Regards

A.Gallus





-----Ursprüngliche Nachricht-----
Von: Axel Gallus [mailto:Axel.Gallus@profindis.de]
Gesendet: Mi 10.11.2010 20:18
An: users@httpd.apache.org
Betreff: AW: AW: [users@httpd] Override main server conf
 

You mean I should use 

AddHandler application/x-httpd-php  .php

instead of

AddType application/x-httpd-php  .php?

Unfortunately this part of the configuration is not under my control.

Can you explain why mixing those directives is a problem?
Is there a workaround?

Regards 

A.Gallus
 



-----Ursprüngliche Nachricht-----
Von: Eric Covener [mailto:covener@gmail.com]
Gesendet: Mi 10.11.2010 20:03
An: users@httpd.apache.org
Betreff: Re: AW: [users@httpd] Override main server conf
 
On Wed, Nov 10, 2010 at 1:58 PM, Axel Gallus <Ax...@profindis.de> wrote:
>
> No errors have been logged in the error log.
>
> Any other idea?
>
> Does someone know if it is possible to user mod_cgi and mod_php at once... (see below)..

Don't mix AddHandler and AddType -- just use AddHandler.


-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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






AW: AW: [users@httpd] Override main server conf

Posted by Axel Gallus <Ax...@profindis.de>.
You mean I should use 

AddHandler application/x-httpd-php  .php

instead of

AddType application/x-httpd-php  .php?

Unfortunately this part of the configuration is not under my control.

Can you explain why mixing those directives is a problem?
Is there a workaround?

Regards 

A.Gallus
 



-----Ursprüngliche Nachricht-----
Von: Eric Covener [mailto:covener@gmail.com]
Gesendet: Mi 10.11.2010 20:03
An: users@httpd.apache.org
Betreff: Re: AW: [users@httpd] Override main server conf
 
On Wed, Nov 10, 2010 at 1:58 PM, Axel Gallus <Ax...@profindis.de> wrote:
>
> No errors have been logged in the error log.
>
> Any other idea?
>
> Does someone know if it is possible to user mod_cgi and mod_php at once... (see below)..

Don't mix AddHandler and AddType -- just use AddHandler.


-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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: AW: [users@httpd] Override main server conf

Posted by Eric Covener <co...@gmail.com>.
On Wed, Nov 10, 2010 at 1:58 PM, Axel Gallus <Ax...@profindis.de> wrote:
>
> No errors have been logged in the error log.
>
> Any other idea?
>
> Does someone know if it is possible to user mod_cgi and mod_php at once... (see below)..

Don't mix AddHandler and AddType -- just use AddHandler.


-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


AW: AW: [users@httpd] Override main server conf

Posted by Axel Gallus <Ax...@profindis.de>.
No errors have been logged in the error log.

Any other idea?

Does someone know if it is possible to user mod_cgi and mod_php at once... (see below)..


Regards 

A.Gallus

-----Ursprüngliche Nachricht-----
Von: Frank Gingras [mailto:francois.gingras@gmail.com]
Gesendet: Mi 10.11.2010 16:12
An: users@httpd.apache.org
Betreff: Re: AW: [users@httpd] Override main server conf
 
On 10/11/2010 10:01 AM, Axel Gallus wrote:
> My main server is configured with
>
>   LoadModule php5_module  modules/libphp5.so
>   AddType application/x-httpd-php         .php
>   AddType application/x-httpd-php-source  .phps
>   DirectoryIndex  index.html index.htm index.shtml index.php index.php3 index.cgi
>   AddHandler      cgi-script      .cgi
>
> Moreover I am allowed to use .htaccess in my webserver root:
>
> <Directory /home/../.public_html/webserverroot>
> 	AllowOverride All
> 	Allow	from All
> </Directory>
>
>
> In my webserver-root I want *.php files executed via mod_cgi and not mod_php5 so I added this to my
> .htaccess in the webserverroot:
>
> Options +ExecCGI
> AddHandler cgi-script .cgi .php
>
> However I get an internal HTTP 500 Error when I try to execute *.php scripts.
> Maybe this is due to the fact, that the server doesn't know if the *.php file
> is to be executed via mod_php5 or mod_cgi. If I rename the *.php scripts to *.cgi they work.
> Is there a way to let the *.php scripts execute via mod_cgi in my virtualhost/webserver-directory
> and having the main-server config having all other virtual hosts configured via mod_php5?
>
> Regards
>
> A.Gallus
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Igor Cicimov [mailto:icicimov@gmail.com]
> Gesendet: Mo 08.11.2010 07:15
> An: users@httpd.apache.org
> Betreff: Re: [users@httpd] Override main server conf
>
> According to mod_mime documentation
>
> Context:    server config, virtual host, directory, .htaccess
>
> "Files having the name extension will be served by the specified
> handler-name. This mapping is added to any already in force, overriding any
> mappings that already exist for the same extension"
>
> so your config should be ok. Did you test if it doesn't work? Do the .cgi
> extension work for the host? Have you added
>
> Options +ExecCGI
>
> to make the files cgi executable for the appropriate directory in that
> virtual host?
>
> Post the vhost config if still having problems.
>
> Igor
>
> On Mon, Nov 8, 2010 at 9:49 AM, Axel Gallus<Ax...@profindis.de>wrote:
>
>>   Hello,
>>
>> I use apache in a virtual host environment.....
>>
>> My main server is configured with
>>
>> LoadModule php5_module  modules/libphp5.so
>> AddType application/x-httpd-php         .php
>> AddType application/x-httpd-php-source  .phps
>> DirectoryIndex  index.html index.htm index.shtml index.php index.php3
>> index.cgi
>> AddHandler      cgi-script      .cgi
>>
>> so that only *.cgi files get executed via interpreter in my
>> vhost-documentroot.
>>
>> I also want the *.php files to be executed as cgi, so I added
>> AddHandler      cgi-script      .cgi .php
>> to my perosnal vhost-config-section
>>
>> However, it seems that the main server config dominates the cgi-script
>> *.php config.
>> Is there a way to also treat .php files as cgi scripts in my virtualhost
>> under
>> this circumstances, how?
>>
>> Thx and regards
>>
>> A.Gallus
>>
>>
>>
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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

What does the error log say, exactly?

Frank.


---------------------------------------------------------------------
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: AW: [users@httpd] Override main server conf

Posted by Frank Gingras <fr...@gmail.com>.
On 10/11/2010 10:01 AM, Axel Gallus wrote:
> My main server is configured with
>
>   LoadModule php5_module  modules/libphp5.so
>   AddType application/x-httpd-php         .php
>   AddType application/x-httpd-php-source  .phps
>   DirectoryIndex  index.html index.htm index.shtml index.php index.php3 index.cgi
>   AddHandler      cgi-script      .cgi
>
> Moreover I am allowed to use .htaccess in my webserver root:
>
> <Directory /home/../.public_html/webserverroot>
> 	AllowOverride All
> 	Allow	from All
> </Directory>
>
>
> In my webserver-root I want *.php files executed via mod_cgi and not mod_php5 so I added this to my
> .htaccess in the webserverroot:
>
> Options +ExecCGI
> AddHandler cgi-script .cgi .php
>
> However I get an internal HTTP 500 Error when I try to execute *.php scripts.
> Maybe this is due to the fact, that the server doesn't know if the *.php file
> is to be executed via mod_php5 or mod_cgi. If I rename the *.php scripts to *.cgi they work.
> Is there a way to let the *.php scripts execute via mod_cgi in my virtualhost/webserver-directory
> and having the main-server config having all other virtual hosts configured via mod_php5?
>
> Regards
>
> A.Gallus
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Igor Cicimov [mailto:icicimov@gmail.com]
> Gesendet: Mo 08.11.2010 07:15
> An: users@httpd.apache.org
> Betreff: Re: [users@httpd] Override main server conf
>
> According to mod_mime documentation
>
> Context:    server config, virtual host, directory, .htaccess
>
> "Files having the name extension will be served by the specified
> handler-name. This mapping is added to any already in force, overriding any
> mappings that already exist for the same extension"
>
> so your config should be ok. Did you test if it doesn't work? Do the .cgi
> extension work for the host? Have you added
>
> Options +ExecCGI
>
> to make the files cgi executable for the appropriate directory in that
> virtual host?
>
> Post the vhost config if still having problems.
>
> Igor
>
> On Mon, Nov 8, 2010 at 9:49 AM, Axel Gallus<Ax...@profindis.de>wrote:
>
>>   Hello,
>>
>> I use apache in a virtual host environment.....
>>
>> My main server is configured with
>>
>> LoadModule php5_module  modules/libphp5.so
>> AddType application/x-httpd-php         .php
>> AddType application/x-httpd-php-source  .phps
>> DirectoryIndex  index.html index.htm index.shtml index.php index.php3
>> index.cgi
>> AddHandler      cgi-script      .cgi
>>
>> so that only *.cgi files get executed via interpreter in my
>> vhost-documentroot.
>>
>> I also want the *.php files to be executed as cgi, so I added
>> AddHandler      cgi-script      .cgi .php
>> to my perosnal vhost-config-section
>>
>> However, it seems that the main server config dominates the cgi-script
>> *.php config.
>> Is there a way to also treat .php files as cgi scripts in my virtualhost
>> under
>> this circumstances, how?
>>
>> Thx and regards
>>
>> A.Gallus
>>
>>
>>
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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

What does the error log say, exactly?

Frank.


---------------------------------------------------------------------
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


AW: [users@httpd] Override main server conf

Posted by Axel Gallus <Ax...@profindis.de>.
My main server is configured with

 LoadModule php5_module  modules/libphp5.so
 AddType application/x-httpd-php         .php
 AddType application/x-httpd-php-source  .phps
 DirectoryIndex  index.html index.htm index.shtml index.php index.php3 index.cgi
 AddHandler      cgi-script      .cgi

Moreover I am allowed to use .htaccess in my webserver root:

<Directory /home/../.public_html/webserverroot>
	AllowOverride All
	Allow	from All
</Directory>


In my webserver-root I want *.php files executed via mod_cgi and not mod_php5 so I added this to my
.htaccess in the webserverroot:

Options +ExecCGI
AddHandler cgi-script .cgi .php

However I get an internal HTTP 500 Error when I try to execute *.php scripts.
Maybe this is due to the fact, that the server doesn't know if the *.php file 
is to be executed via mod_php5 or mod_cgi. If I rename the *.php scripts to *.cgi they work.
Is there a way to let the *.php scripts execute via mod_cgi in my virtualhost/webserver-directory 
and having the main-server config having all other virtual hosts configured via mod_php5?

Regards

A.Gallus












 



-----Ursprüngliche Nachricht-----
Von: Igor Cicimov [mailto:icicimov@gmail.com]
Gesendet: Mo 08.11.2010 07:15
An: users@httpd.apache.org
Betreff: Re: [users@httpd] Override main server conf
 
According to mod_mime documentation

Context:    server config, virtual host, directory, .htaccess

"Files having the name extension will be served by the specified
handler-name. This mapping is added to any already in force, overriding any
mappings that already exist for the same extension"

so your config should be ok. Did you test if it doesn't work? Do the .cgi
extension work for the host? Have you added

Options +ExecCGI

to make the files cgi executable for the appropriate directory in that
virtual host?

Post the vhost config if still having problems.

Igor

On Mon, Nov 8, 2010 at 9:49 AM, Axel Gallus <Ax...@profindis.de>wrote:

>  Hello,
>
> I use apache in a virtual host environment.....
>
> My main server is configured with
>
> LoadModule php5_module  modules/libphp5.so
> AddType application/x-httpd-php         .php
> AddType application/x-httpd-php-source  .phps
> DirectoryIndex  index.html index.htm index.shtml index.php index.php3
> index.cgi
> AddHandler      cgi-script      .cgi
>
> so that only *.cgi files get executed via interpreter in my
> vhost-documentroot.
>
> I also want the *.php files to be executed as cgi, so I added
> AddHandler      cgi-script      .cgi .php
> to my perosnal vhost-config-section
>
> However, it seems that the main server config dominates the cgi-script
> *.php config.
> Is there a way to also treat .php files as cgi scripts in my virtualhost
> under
> this circumstances, how?
>
> Thx and regards
>
> A.Gallus
>
>
>
>
>
>
>


Re: [users@httpd] Override main server conf

Posted by Igor Cicimov <ic...@gmail.com>.
According to mod_mime documentation

Context:    server config, virtual host, directory, .htaccess

"Files having the name extension will be served by the specified
handler-name. This mapping is added to any already in force, overriding any
mappings that already exist for the same extension"

so your config should be ok. Did you test if it doesn't work? Do the .cgi
extension work for the host? Have you added

Options +ExecCGI

to make the files cgi executable for the appropriate directory in that
virtual host?

Post the vhost config if still having problems.

Igor

On Mon, Nov 8, 2010 at 9:49 AM, Axel Gallus <Ax...@profindis.de>wrote:

>  Hello,
>
> I use apache in a virtual host environment.....
>
> My main server is configured with
>
> LoadModule php5_module  modules/libphp5.so
> AddType application/x-httpd-php         .php
> AddType application/x-httpd-php-source  .phps
> DirectoryIndex  index.html index.htm index.shtml index.php index.php3
> index.cgi
> AddHandler      cgi-script      .cgi
>
> so that only *.cgi files get executed via interpreter in my
> vhost-documentroot.
>
> I also want the *.php files to be executed as cgi, so I added
> AddHandler      cgi-script      .cgi .php
> to my perosnal vhost-config-section
>
> However, it seems that the main server config dominates the cgi-script
> *.php config.
> Is there a way to also treat .php files as cgi scripts in my virtualhost
> under
> this circumstances, how?
>
> Thx and regards
>
> A.Gallus
>
>
>
>
>
>
>