Results 1 to 2 of 2

Thread: Moving config.php files out of public directory

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Unhappy Moving config.php files out of public directory

    The bluehost security tips recommend moving php config files (containing mysql passwords etc) into a folder above the public_html folder.

    I understand the concept, but am struggling with the execution. Presumably I add an include statement in the relevant php file to point to the password include file, but what would be the pathname for the include file?

    For example, if the password file was mypwd.php (example) in the account root folder, would the include statement be;

    include("/mypwd.php");

    Doesn't the "/" just take me to the web root folder?

  2. #2
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,944

    Default

    To go to mypwd.php in the directory immediately above the root folder from a script in the root folder you'd use

    require_once '../mypwd.php';

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •