Re: Opendir on site root directory?
| From: | Clancy | Date: | Wed, 11 Mar 2009 01:01:27 +0000 |
| Subject: | Re: Opendir on site root directory? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289812@lists.php.net to get a copy of this message | ||
On Tue, 10 Mar 2009 15:12:57 +0000, stuttle@gmail.com (Stuart) wrote:
>Please keep the discussion on-list.
>
>2009/3/10 Clancy <clancy_1@cybec.com.au>
>
>> Hi,
>>
>> After I posted my message to the group today I realised that my program
>> achieves its
>> almost infinite flexibility by loading different include files in different
>> circumstances,
>> and from many different parts of the program. The program always specifies
>> the location
>> of the include file by the relative path from the root directory. If the
>> uncertainty
>> about the current working directory you worry about were really a problem
>> this would never
>> work, but I have been doing this for well over a year, and had never had
>> any problems.
>>
>
>Just because you haven't experienced a problem with the way you do things
>yet it certainly doesn't mean the problem isn't there. You're not specifying
>the location of an include file relative to the home directory, it's
>relative to the current working directory which is not necessarily the
>directory you expect it to be.
The only circumstances in which my assumption could fail would be if I changed to a new
provider with a different operating system. In the unlikely event of this happening all I
would need to do would be to determine the actual directory, and chdir to the desired one.
This would require at most half a dozen lines of code at the start of the program, so it
would not be a significant hassle.