Reply to Re: use virtual hosts to develop locally but upload throws error in source file references

Your name:

Reply:


Posted by Manish on 01/23/07 12:45

As I am not having much experience, I don't know if the following will
result any security vulnerability, or may be effect at other part of
the code causing unexpected results internally.

/* concat path */

$_SERVER['DOCUMENT_ROOT'] .= "/clients/site1";


But for temporary purpose, can this be used at the top of every page/or
any common page that is being included by all other files.



What I generally do is,

(in config file)

define('APP_DIR', '/any/path/if/present/');
define('APP_FULL_URL', 'http://'.$_SERVER["HTTP_HOST"].APP_DIR);

and use "APP_FULL_URL" to include files, etc.


Other is I define a variable $basepath at the top of every page, that
is relative to the directory that has main index file for the site.

/
all files have $basepath="./";

/dir1/
/dir2/
all files have $basepath="./../";


/dir1/subdir1/
/dir2/subdir1/
all files have $basepath="./../../";

defined at top of page.

And $basepath is used for including all other files.


May not be good way to do, but has been working fine for all projects
till now.



Paul wrote:
> On my development computer, I have virtual named host set up, like
> www.site1.lab.
>
> When I upload those to my web site for customer review under
> mywebsite.com/clients/site1/
> it throws some of the source file references off and it does not work
> properly.
>
> My references are like:
> require_once($_SERVER['DOCUMENT_ROOT']."/utility/top.php");
>
> Obviously those will not work since $_SERVER['DOCUMENT_ROOT'] references
> mywebsite.com.
>
> Is there anything I can do in apache.conf for a virtual directory that would
> make it so when I upload a site for customer review, I don't have to change
> the source references?

[Back to original 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

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