Jump to content

Recommended Posts

Place it outside of the document root and make sure it's not readable by anybody but the webserver.

in my case, what is the document root here:/home/mary

on the cpanel structure?

and is that possible on shared hosting(Place it outside of the document root and make sure it's not readable by anybody but the webserver.)

I've never used CPanel, so I can't guide you through the GUI.

 

Generally speaking: The document root is the directory used by your webserver to store public files. It's probably “public_html” in your case, so you'll want to keep your database credentials out of this folder. Otherwise you risk leaking the data.

 

Setting the permissions, again, depends on your specific configuration. If you're using the Apache webserver, it probably runs under the “www-data” user. So you'd assign the credentials file to the owner and group “www-data” and set the permissions to something like 0400 (meaning: read permissions for the owner, no permissions for everybody else).

  • 1 month later...

I'm also on a shared hosting site with cPanel.

 

My structure is :

 

/home/username/

    /public_html  <-- this is the folder that apache serves my webpages from.

    /includes      < -- I store files here (including my db credentials file) in this folder.  Then my web pages INCLUDE these files.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.