Take a directory structure like the following:
~/example.com/ html/ includes/ logs/
html is the public website and the includes are where includes like db connection settings are kept. In ~/example.com/html/index.php you can call use something like the following to get the file system path of example.com that you can use to include the resulting files. This will do it automatically so it works with different installations:
<?php
define('PATH_TO_ROOT', realpath(dirname(__FILE__).'/..'));
include_once(PATH_TO_ROOT.'/includes/config.inc.php');
?>
phpprogramming