Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Aaaa... Thanks!! I searched manual of mod_fcgid but totally forget about common apache directives.. THANKS! –  vladimirm Jul 31 '11 at 16:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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