Re: Uploading into website directory for Php files
| From: | Edward Vermillion | Date: | Mon, 26 Feb 2007 18:06:40 +0000 |
| Subject: | Re: Uploading into website directory for Php files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249465@lists.php.net to get a copy of this message | ||
On Feb 26, 2007, at 11:22 AM, StainOnRug@aol.com wrote:
Thanks alot for your response.. your information really was a help. but now knowing that I an use a folder in my root DIR.. how do I let PHP know where to look? For example the location lets say ofI believe there is a way to either add paths or change the include_path directive in your php script, you'll have to look in the manual: http://us3.php.net/manual/en/ini.php I'm not too sure about it because I don't rely on the include_path directive to locate my included files. I always give an absolute path when I call them, just so I know for sure what I'm getting. To use your example: <?php include '/files/include/foo.php'; // Do something with foo... ?> instead of: <?php include 'foo.php'; // Do something with foo... ?> there *could* be another 'foo.php' in the path that gets grabbed before the one you want. Or you can set a constant to the includes directory: <?php define('INCLUDE_DIR', '/files/include'); include INCLUDE_DIR.'foo.php'; // Do something with foo... ?> By setting a constant to the directory, if you change the location of the directory, then you only need to change the script in one spot instead of hunting for all the include calls. Of course if you're working with someone else's code and *they* are relying on include_path being set correctly then you're pretty much stuck with that, unless you want to rewrite their code. Edmy include fold is www.example.com/files/include how do I tell PHP to search that DIR? Thank you soo much! honestly!