You are here: Re: include("/main.php") won't work on a hosting machine « PHP Programming Language « IT news, forums, messages
Re: include("/main.php") won't work on a hosting machine

Posted by Michael Fesser on 06/19/07 20:23

..oO(Chuck Anderson)

>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?

You mean something like

include '/foo.php'; ?

The document root of the webserver ($_SERVER['DOCUMENT_ROOT']) and the
root of the server's file system are two completely different things.
The above statement would look for the file in the server's physical
root directory, where no normal user should have write access - it's a
system-only area. The webserver's root directory is usually something
like '/home/username/public_html', where you can do whatever you want.

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация