Apache Server configuration support - Re: use virtual hosts to develop locally but upload throws error

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > January 2007 > Re: use virtual hosts to develop locally but upload throws error





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: use virtual hosts to develop locally but upload throws error
Hendri Kurniawan

2007-01-20, 7:26 pm

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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com