enveetee Posted February 10, 2015 Share Posted February 10, 2015 Hi As my application grows, I am becoming more and more concerned about my configuration and .INC files which are contained within sub directories of my web root folder. I am lead to understand that it is good practice to move sensitive files (those containing passwords and mysql logon credentials) outside of the general www folder How do I access those files in PHP with, say an include or required statement I am currently using include'../configuration/config.php' how do I access files above ../ Thanks Link to comment https://forums.phpfreaks.com/topic/294492-how-to-access-files-outside-web-root/ Share on other sites More sharing options...
QuickOldCar Posted February 10, 2015 Share Posted February 10, 2015 Those .inc files can be renamed with a .php extension so they can't be visited and read as a text document Create a new directory(folder) in the /var directory let's use web_files as the new directory give www-data permission for web_files I create a new directory to keep them all in one place and also to prevent any accidental deletions or overwriting You can then access as any other include or require include('/var/web_files/configuration/config.php'); Link to comment https://forums.phpfreaks.com/topic/294492-how-to-access-files-outside-web-root/#findComment-1505346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.