For required/included files in PHP, is it better to use .inc extensions vs .inc.php vs .php extensions?
Apache can sometimes (due to bugs or severe crashes) serve .php files as text (happend to me a few times on shared hosting).... I think you can use any extension you want as long as you don't store your files in a public folder.
Let's say your site is in /home/user/public_html/
create another folder /home/user/lib_php/
have the files:
(1) .../lib_php/one.class.php with
class one {
//...
}
(2) .../lib_php/two.function.php with
function two() {
//...
}
and you have the main index.php in /public_html
$x=a;
$b=two($x);
$c=new one;
//etc..
or
This way you are taking every precaution the files are not reachable directly but can be used by your scripts...