Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP include file extensions?

For required/included files in PHP, is it better to use .inc extensions vs .inc.php vs .php extensions?

like image 428
ina Avatar asked Aug 02 '10 19:08

ina


1 Answers

Sometimes people use the .inc extension and then do some server configuration to keep .inc files from being accessed via a web browser. This might be good, if done absolutely correctly by a knowledgeable sysadmin, but there's a better way: Any file that's not supposed to be accessed by web users should be kept outside your document root. Once these files are off the web, so to speak, you can use whatever extension you want. .php is definitely a sensible choice for syntax highlighting, general sanity, and so on.

like image 102
grossvogel Avatar answered Oct 19 '22 00:10

grossvogel