.oO(Tim Van Wassenhove)
* No one is able to call them from the outside.
If it was impossible or unwanted to call scripts from the outside, why
would there be scripts in the first place?
I was referring to scripts performing backend tasks, initialization,
database queries, form processing, calculations etc., in other words all
the "application logic" or whatever you like to call it. Of course the
scripts representing webpages have to be accessible.
* No one is able to call scripts out of context, which may lead to
strange results and error messages.
Actually, this depends totally on how the scripts are designed. If they
are well-designed, they will know when they are expected to be executed
(and when they should dispatch controll to another script).
Do you know for all of your scripts how they will react if they are
called directly? Even if you put everything in classes and functions,
there may still be unresolved dependencies because the script was not
called from within another it depends upon. I have many scripts that
call methods of a global application object. If this object is not
available it'll rain error messages. I avoid such trouble with simply
making them not available to the public. All application and library
stuff is outside the document root.
* You don't have to worry about filename extensions, don't have to use
.php all the time.
Again, this is true for both public as non-public areas. And thus not a
good reason to put them outside the public area.
An often heard "security" argument is to give scripts the extension .php
so the server would always parse them (.inc files would be delivered as
plain text for example in most cases). Outside the document root the
filename simply doesn't matter, because it's out of reach of the
webserver and the PHP interpreter doesn't care about filenames.
Micha