Re: climb up the path
| From: | Jim Lucas | Date: | Wed, 18 Jun 2008 17:39:38 +0000 |
| Subject: | Re: climb up the path | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275534@lists.php.net to get a copy of this message | ||
Iv Ray wrote:
Jim Lucas wrote:So, saying that it is outside the source does not tell me if it is outside the document root. So, I guess my option might still work in this case. Use your include_path php_ini setting if you have a main file that you include, like I have one that is called handy.php that is included at the top of every script. In this main file, you could modify your include_path #main_included_file.php <?php #if you are trying to go to the parent folder, then just ../ #but if you want to go to the parent/parent folder use ../../ ini_set('include_path', '../../;../;'.ini_get('include_path')); #the rest of your stuff goes here. ?> Then... #yourscript.php <?php include_once 'main_include_file.php'; include 'config.php'; ... ?> This should work for any host. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William ShakespeareIv, tell me why you are wanting to do this? If it is the reason I think it is, I can give you a better way to accomplish this.I have the source and a configuration file, which I want outside the source - it is different from server to server. The easiest is to have the configuration file one folder up. In the same time I want the source to work wherever it is placed. So the source sees where it is, and climbs one directory up to read the configuration specific for this installation. I do not want to use "ignore" in the repository, in order to prevent the configuration file from being overwritten. Iv