1

I have working FastCGI PHP inside Apache using mod_fcgid. But I noticed that PHP scripts are executed even without .php suffix specified.

Eg: if file is mail.php then http://example.com/mail.php and http://example.com/mail returns same output of PHP file mail.php

Is this common behaviour? And should be this (execution without suffix) disabled?

my Apache configuration is:

AddHandler fcgid-script .php
<Directory "{WwwRoot}">
    Options -Indexes MultiViews FollowSymLinks +ExecCGI
    FCGIWrapper {ConfigsRoot}/fcgi-php5 .php
    Order allow,deny
    allow from all
</Directory>

with simple wrapper

#!/bin/sh
PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=2000
export PHP_FCGI_MAX_REQUESTS
/usr/bin/php5-cgi

Thanks.

1
  • As @LazyOne said, this behavior is up to you, but it may behoove you to leave it, as you can use /mail/ instead of /mail.cgi to hide the fact that you're using CGI, and also, may get better SEO outta such a configuration. IF your example were real estate listings. you'd have /listings/NY/Albany/ instead of /listings.cgi?st=NY&city=Albany
    – Roy Rico
    Jul 31, 2011 at 16:11

1 Answer 1

3

Is this common behaviour?

It's your specific settings.

Solution: Options -MultiViews

Apache Manual says (you will have to scroll down a bit):

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.


And should be this (execution without suffix) disabled?

Up to you. By default such behaviour is disabled.

1
  • Aaaa... Thanks!! I searched manual of mod_fcgid but totally forget about common apache directives.. THANKS!
    – vladimirm
    Jul 31, 2011 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .