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

with simple wrapper



  • 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 '11 at 16:11

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.