suttercain Posted March 14, 2007 Share Posted March 14, 2007 Hi everyone, I was reading a PHP book and it suggested to save include files as .inc instead of the typical .php. Out of curiosity, why is that? What re the benefits of saving it as an .inc instead of a typical .php, .css or .html? Security? If so how does it help? Thank you advance. Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/ Share on other sites More sharing options...
mwstewart Posted March 14, 2007 Share Posted March 14, 2007 Hello there, there is no technical advantage, it's merely so you can easily identify them. They can be saved as anything you like. Mark Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/#findComment-207265 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 There are no benefits to it, there is a disadvantage, that anyone can see your code by going to .inc. I would name them as .php so that the code stays hidden from viewers. --FrosT Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/#findComment-207266 Share on other sites More sharing options...
suttercain Posted March 14, 2007 Author Share Posted March 14, 2007 Ok. Because I thought it was a security feature. My bad. It is actual a bad way to include password information then since you can "view" the source code. Thanks. Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/#findComment-207267 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 there is a security feature involved. saving your includes with a .php extension is more secure. Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/#findComment-207268 Share on other sites More sharing options...
obsidian Posted March 14, 2007 Share Posted March 14, 2007 Ok. Because I thought it was a security feature. My bad. It is actual a bad way to include password information then since you can "view" the source code. The idea of having "inc" somewhere in the name is a great idea for organizing your files. I like to have all my include files named something like "inc.functions.php" so that they all show up together in my directories. Same thing with class declarations: "class.Utilities.UserHandler.php" seems like a long name, but it sure helps in organization. Link to comment https://forums.phpfreaks.com/topic/42723-solved-includes-to-be-saved-as-inc-instead-of-php-or-html-why-is-that/#findComment-207272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.