|
Posted by Jerry Stuckle on 10/16/07 00:49
Rik Wasmus wrote:
> On Tue, 16 Oct 2007 01:27:54 +0200, Jerry Stuckle
> <jstucklex@attglobal.net> wrote:
>
>> duzhidian@gmail.com wrote:
>>> On Oct 15, 4:56 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> duzhid...@gmail.com wrote:
>>>>> failed to open stream: No such file or directory
>
> <snip>
>
>>>> Don't use relative paths. Use absolute paths. If you're running this
>>>> under a webserver, you can get to the web server's root with
>>>> $_SERVER['DOCUMENT_ROOT'] and go from there.
>>
>> > If I move the programs to other places, using absolute paths will
>> > suffer, need to change every file.
>> >
>> >
>> (top posting fixed)
>>
>> Not if you use the method I mentioned.
>
> It would cause trouble if he decides to put them somewhere else in the
> tree though....
>
> I usually use this kind of reasoning:
>
> 1. A custom/the main script uses absolute paths from DOCUMENT_ROOT
> 2. Little reusable add-in modules (which could be anywhere) use relative
> paths, but check & store getcwd(), change it to their path, do the file
> action and immediately change it back to the old value.
>
> --Rik Wasmus
>
That's true. But I always use the same format. Included files go below
the website's root directory. Others go in a specific directory in the
root. But there are very few of the latter :-)
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|