angelsonearth Posted July 27, 2012 Share Posted July 27, 2012 Hello, friends! I'm wanting to make a subfolder in htdocs that would point to the root directory for my Web page. I'm initially placing my Web page on the localhost server, but intend to eventually transfer it to a paid remote server. I'm wondering if I would place the mysql_connect file (in order to keep it secure) either 1. inside the htdocs folder but one folder above the root directory or 2. above the directory for the htdocs folder as is done in Larry's book. (Forgive me if I'm not expressing this correctly) If 2. above is correct, how would I reference the mysql_connect file in the includes? Also, where would I place the msql connect file on a local host server if it's one (or two?) levels outside of the Web root directory? Thank you for your time and energy! Link to comment Share on other sites More sharing options...
Antonio Conte Posted July 27, 2012 Share Posted July 27, 2012 As long as you are able to include a file, it's usable even though unreachable from a browser. It's more normal to place the configuration details outside the web root than a connection script. Non of this is really "insecure". I would just make sure error messages are not displayed on the server. 1 Link to comment Share on other sites More sharing options...
Jaepee Posted July 28, 2012 Share Posted July 28, 2012 If 2. above is correct, how would I reference the mysql_connect file in the includes? Depends on your server and where the file is located for my virtual server I have to write the following code to access my connection script. include('../../mysqli_connect.php'); // my server // // or include('/home/user_name/mysqli_connect.php'); // could work also // Hope this helps some jp Link to comment Share on other sites More sharing options...
angelsonearth Posted August 10, 2012 Author Share Posted August 10, 2012 Thank you very much, friends, for the wonderful advice! FYI, I found some other relevant material related to assigning the mysqli_connect file to a location outside of the server. It's in Larry Ullman's book on Effortless Ecommerce around page 123. He basically says that some servers won't allow you to upload a document outside of the root Web directory (shared servers?), but you could password protect the file (or, the file's directory(?)) within the Web root. 1 Link to comment Share on other sites More sharing options...
Recommended Posts