colinexl Posted July 22, 2007 Share Posted July 22, 2007 Hi All, I have a php script that contains the login information to my SQL database. I was wondering if there is a secure way of protecting access to that php page? I will want the server to be able to read it, but just not any users who stumbles upon that page. Right now if I try to view that page in a browser, all I get is a blank page. However, I don't feel that this is a very solid way of protecting a php page. Thanks, Colin Quote Link to comment https://forums.phpfreaks.com/topic/61281-how-to-protect-php-files/ Share on other sites More sharing options...
wildteen88 Posted July 22, 2007 Share Posted July 22, 2007 No one can view the true PHP source code of .php files from a web browser so no need to worry. The only time when someone can see the true source code of your php script is either the server is not setup properly or someone manages to get hold of your FTP username/password. No source code is ever returned - only the output (html/text). If php source code was always returned every site that was coded in php would be so easy to hack. Quote Link to comment https://forums.phpfreaks.com/topic/61281-how-to-protect-php-files/#findComment-304918 Share on other sites More sharing options...
colinexl Posted July 22, 2007 Author Share Posted July 22, 2007 Ah, thank you very much. You made me feel a lot safer now. I kinda figured that PHP is robust enough for this not to be an issue. Quote Link to comment https://forums.phpfreaks.com/topic/61281-how-to-protect-php-files/#findComment-304922 Share on other sites More sharing options...
tanvir Posted July 22, 2007 Share Posted July 22, 2007 Another way to protect your valuable login info is to place all common files outside the document root and giving it a .php file extensions for more protection. Quote Link to comment https://forums.phpfreaks.com/topic/61281-how-to-protect-php-files/#findComment-304940 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.