Gmunky Posted June 6, 2007 Share Posted June 6, 2007 Is there a difference between naming a file that is to be included in a script with a .php or .inc extension? For intance, if I want to include a script with my database connection info, does it matter if I use include ("db.php"); or include ("db.inc"); ? is one more secure than the other? Thanks for the info! Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/ Share on other sites More sharing options...
pocobueno1388 Posted June 7, 2007 Share Posted June 7, 2007 If you connecting to the database using PHP, then I would assume it would require the .php extension. I'm not 100% sure though. Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269610 Share on other sites More sharing options...
Wireless102 Posted June 7, 2007 Share Posted June 7, 2007 yes, a inc file will let anyone read it. a php file will not display the information Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269611 Share on other sites More sharing options...
Wireless102 Posted June 7, 2007 Share Posted June 7, 2007 and its best to store those types of files outside of the public directory Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269615 Share on other sites More sharing options...
Dragen Posted June 7, 2007 Share Posted June 7, 2007 If you connecting to the database using PHP, then I would assume it would require the .php extension. I'm not 100% sure though. I'm sure that you could include an .inc file inside a .php file. I know you can include other filetypes, such as .txt, so I see no reason why you shouldn't be able to include .inc. I don't know about .inc files though, so I can't comment on security issues.. Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269616 Share on other sites More sharing options...
trq Posted June 7, 2007 Share Posted June 7, 2007 I don't know about .inc files though, so I can't comment on security issues.. The security issue is that if someone accesses an *.inc file directly, it will be shown as plain text. So... if it contains valuable data (database usernames / passwords) your foobared. Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269687 Share on other sites More sharing options...
Yesideez Posted June 7, 2007 Share Posted June 7, 2007 I label all my PHP includes as "inc_*.php" That way I can see which files are includes and they all show in the same place in Windows Quote Link to comment https://forums.phpfreaks.com/topic/54510-general-question/#findComment-269690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.