Forum Moderators: phranque

Message Too Old, No Replies

'AddType' and 'Action' set globally - cannot disable CGI!

         

ayqazi

5:30 am on Jul 25, 2009 (gmt 0)

10+ Year Member



Hi,

So I decided to try to be smart. I want to selectively enable CGI per each vhost or directory, but in an easy way.

So I thought, globally, I'd do this:


ScriptAlias /usr-bin/php5-cgi /usr/bin/php5-cgi
AddType application/x-httpd-php .php
Action application/x-httpd-php /usr-bin/php5-cgi
...
<Directory />
Options ... -ExecCGI
</Directory>

Then, in every vhost/directory, I could simply do:


Options +ExecCGI

and it would work. Wrong!

I want CGI to be disabled by default, but it's not. My instance of squirrelmail, for example, still works when it shouldn't be!

There are no .htaccess files anywhere doing funny things, I checked (for this vhost anyway)

How can I make sure CGI is only enabled explicitly when I want it like I am trying to?

Thanks.

Caterham

5:55 pm on Jul 25, 2009 (gmt 0)

10+ Year Member



PHP via CGI is slow. Use Fastcgi as a replacement.

AddType application/x-httpd-php .php

Using MIME types for handlers is evil coding. Use AddHandler if you're invoking handlers.

Then, in every vhost/directory, I could simply do:

Options +ExecCGI

To activate PHP in every vhost/directory, you could simply do

AddHandler application/x-httpd-php .php

ExecCGI controls the execution for that folder, but your php file is not executed. /usr/bin/php5-cgi is. You you've to enable ExecCGI for /usr/bin/ (what you're doing via ScriptAlias).

See RemoveHandler if you'd like to remove a previous AddHandler.

ayqazi

11:18 am on Jul 27, 2009 (gmt 0)

10+ Year Member



I'm already using FastCGI, but this problem was easier to explain using just normal CGI.

Point taken about addtype - will change that for AddHandler

And I finally understand the point of ExecCGI - thanks!