You are here: AW: [PHP] [NEWBIE] Confused about usage of $_SERVER['DOCUMENT_ROOT'] « PHP « IT news, forums, messages
AW: [PHP] [NEWBIE] Confused about usage of $_SERVER['DOCUMENT_ROOT']

Posted by Mirco Blitz on 02/20/05 19:35

Hi,

what does echo $imageFile print and what do you do afterwards with it.
Probably there is the error.

Mit freundlichen Grüßen
Mirco Blitz

-----Ursprüngliche Nachricht-----
Von: Dave [mailto:dave@tokyocomedy.com]
Gesendet: Sonntag, 20. Februar 2005 18:15
An: php-general
Betreff: [PHP] [NEWBIE] Confused about usage of $_SERVER['DOCUMENT_ROOT']

PHP General,

The Situation:
I would like to be able to specify locations of scripts and files
relative to the "root" directory from which my web site is served. I thought
this was what $_SERVER['DOCUMENT_ROOT'] was for.

The Problem:
When I use $_SERVER['DOCUMENT_ROOT'], it creates a path starting from
somewhere deep down in the server's file structure, below where I even have
authorized access. So if I specify a file like so:
$imageFile = $_SERVER['DOCUMENT_ROOT'] . "/images/image.jpg";
... PHP gets lost and doesn't locate it.
What I am looking for is a variable which will specify the base
directory that my web site is rooted in. In other words, starting from the
same directory that my index.html file is in.

The Question:
How do I specify the directory that my web site is situated in, the same
directory where my main index.html file is? Is there a different variable I
should be using, or perhaps some configuration of $_SERVER['DOCUMENT_ROOT']
that needs to be applied?

What I've Tried So Far:
First I went to the on line PHP manual, which is where I found out about
$_SERVER['DOCUMENT_ROOT'] in the first place. Of all the server variables
available, 'DOCUMENT_ROOT' seems to describe what I'm looking for, but
doesn't behave how I would expect.
A Google search was equally ineffective in educating me in what basic
concept I am missing.

Any advice would be much appreciated.

--
Dave Gutteridge
dave@tokyocomedy.com

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

 

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

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