Search Engine Optimization > Web Development > PHP include files and [root]/folder/file requests
PHP include files and [root]/folder/file requests
Posted by :::Jerry:::: on February 28th, 2006


Page URL is [root]/common/template.php - having arrived from a php
redirect on the [root]index.php page.

The problem is that a request to obtain any php 'include' files using
[root]/folder/file, such as <?php include "/incs/menu2.inc"; ?>,
doesn't work. But a similar request from the same page to obtain
images from a [root]/folder/file request, such as
src="/extras/btcc0409.jpg" does.

Hope the above makes sense. Are php include files handled differently
to other file types, if not, anyone got any pointer as to what I'm
doing wrong?... Help!


Posted by David Dorward on February 28th, 2006

:::Jerry:::: wrote:

Paths in PHP are filesystem paths. If you start them with a / then they are
relative to the filesystem room.

Paths in URLs are URL paths. If you start them with a / then they are
relative to the root of the domain.

You can grab the filesystem path to the root of the filesystem with
$_SERVER['DOCUMENT_ROOT']

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Funbolt.com - Entertainment portal, wallpapers, sexy celebs