"jpb" <jp*@arcor.de> wrote in message
news:pa****************************@arcor.de...
Could someone please help me with this.
I want to use PHP in my website; but run into a snag, the recommended
method of calling an include is:
<?php include($_SERVER["DOCUMENT_ROOT"]."/inc/css-gateway.inc"); ?>
when I try
<?php ECHO $_SERVER["DOCUMENT_ROOT"]; ?> the document root is shown as
/usr/local/apache/htdocs/
However the website root is at:
/mnt/home/www/canadian-dream.com/www
How do I redirect $_SERVER["DOCUMENT_ROOT"] to the my website root? Is
there a global variable that can be used? I do not wish to rewrite a lot
of pages if I were to change web host in the future.
from the error logs
[Sat Oct 25 06:32:51 2003] [error] PHP Warning:
main(/usr/local/apache/htdocs/inc/css-gateway.inc): failed to open stream:
No such file or directory in
/mnt/home/www/canadian-dream.com/www/de/immobilien/main.php on line 15
[Sat Oct 25 06:32:51 2003] [error] PHP Warning: main(): Failed opening
'/usr/local/apache/htdocs/inc/css-gateway.inc' for inclusion
(include_path='.:/usr/local/lib/php') in
/mnt/home/www/canadian-dream.com/www/de/immobilien/main.php on line 15
Thanks
Paul
Have you examined the output of phpinfo();
You have two different paths noted in your log file - One in
/usr/local/apache/htdocs, and the other in /mnt/home/www/canadian-dream.com.
The "/mnt" in one file path leads me to believe you are using NFS, which if
true, is likely to be part of the problem... If you are using Apache, I know
it can serve on an NFS server, however I do know there are some issues that
one must consider when configuring the server - I can't recall what they are
but maybe that gives you a couple of things to work on... an alternative
workaround would be to create a variable that has your "include" directory
hard-coded which you use instead of using "$_SERVER[DOCUMENT_ROOT]" -
therefore whenever you move the script, you only have to change one
variable, but I don't really like that sort of idea.
Hope that gives you some ideas...