You are here: Re: How to make the include path universal? « PHP Programming Language « IT news, forums, messages
Re: How to make the include path universal?

Posted by tom pester on 09/06/05 13:55

Hi Jerry,

Using $_SERVER['DOCUMENT_ROOT'] is indd the standard php way but my problem
is that it's not defined on a windows IIS box (I confirmed this by reading
previous posts).

Cheers,
Tom Pester

> phpWalter wrote:
>
>> We solve the prolbem by defining a base "vars.php" file at the "root"
>> of the site.
>>
>> In there we define paths to constants, and then these constants are
>> used to INCLUDE files as needed.
>>
>> var.php
>>
>> define( INCLUDE_PATH, '/my/path/includes/');
>>
>> now I can incluse my files as Ineed
>>
>> include_once INCLUDE_PATH . 'base_functions.php';
>>
>> All you need to do is update that one constant as you move from site
>> to site and it works fine.
>>
>> Linux or windows.
>>
>> walter
>>
> Walter,
>
> Looks like unnecessary work to me. And what happens if the root
> directory of the site is moved? Or you need to use the same pages on
> another server? Everything breaks until you change your var.php.
>
> I'd rather use something like:
>
> include_once($_SERVER['DOCUMENT_ROOT'].'/includes/base_functions.php')
> ;
>
> This changes automatically based on your Apache document root setting.
>

 

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

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