|
Posted by Chuck Anderson on 06/19/07 20:03
Jerry Stuckle wrote:
> Summercoolness@gmail.com wrote:
>
>> if you are just a users among the 100s of users on a hosting machines,
>> then if you do a include("/main.php"); it won't include the file
>> but will say
>>
>> Failed opening required '/main.php' (include_path='.:/usr/local/nf/
>> lib/php')
>>
>> it seems ok to include("../main.php"); except the file will not work
>> if moved from www.abc.com/movies to a new location of
>> www.abc.com/movies/little-mermaid is there a better solution for
>> this?
>>
>>
>
> include ($_SERVER['DOCUMENT_ROOT']) . '/main.php');
>
> That way you don't have to worry about include paths, which some hosts
> don't allow you to change. It also works on IIS, which doesn't have
> .htaccess.
>
>
Wow. Serendipity? Synchronicity? ... I was about to ask this very same
question ... downloaded today's new messages, and I see someone did it
for me (thanks to summercoolness).
And it is also came to me just this morning that ....
include "{$_SERVER['DOCUMENT_ROOT']}/file_to_include.php";
.... was the solution.
But .... do you happen to understand why "/" does not work with include
to indicate the root dir?
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************
Navigation:
[Reply to this message]
|