You are here: Re: use virtual hosts to develop locally but upload throws error in source file references « PHP Programming Language « IT news, forums, messages
Re: use virtual hosts to develop locally but upload throws error in source file references

Posted by Hendri Kurniawan on 01/21/07 00:10

Paul wrote:
> That works but here's the issue. I develop locally using virtual host like
> www.client1site.com. When I want my client to see the progress, I upload
> to:www.mysite.com/clients/client1/
>
> So you can see that by referencing:
> require_once($_SERVER['DOCUMENT_ROOT']."/utility/top.php");
> take the reference to mysite.com/utility/, where instead I want it to go to
> mysite.com/clients/client1/utility
>
> Does that make better sense?
>
> I am just looking for a way where I don't have to change all my references
> when I upload it for client review, BEFORE uploading it to it's final host.
>
>


On your "DEV" machine create a file called const_path.php (or something
like that) on a fixed location.
Similar to your "DEPLOYMENT" machine,
create another file (with same name, with same location relative to
$_SERVER['DOCUMENT_ROOT'].

On that file, you define your path constants.
On your "DEV" machine.... it will be: define('CONST_PATH_UTILITY',
$_SERVER['DOCUMENT_ROOT'].'/utility');
On your "DEPLOYMENT" machine ... define('CONST_PATH_UTILITY',
$_SERVER['DOCUMENT_ROOT'].'/clients/client1/utility');

On your page, you need to include the file:
require_once($_SERVER['DOCUMENT_ROOT'].'/const_path.php');

Then you include your utility file:
require_once(CONST_PATH_UTILITY . '/top.php');

Make sure you don't overwrite the two different const_path.php between
"DEV" and "DEPLOYMENT" server


--- OR ---

you can always use relative path :)


Hendri Kurniawan

 

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

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