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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Stuckle

    #16
    Re: use virtual hosts to develop locally but upload throws errorin source file references

    Michael Fesser wrote:
    .oO(Jerry Stuckle)
    >
    >And if you ever change hosts to someone using the Apache extension,
    >you'll be SOL. It's even worse if you change to a Windows host.
    >
    Why should I? My own sites and the sites I maintain are hosted on
    servers carefully chosen by me. There's no reason to change.
    >
    Micha
    And I've heard that one so many times before. The last time just a few
    months ago with a company who had been an excellent provider for years.

    Companies change. Management changes. Companies get new owners. And
    companies go out of business.


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Manish

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


      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_FUL L_URL', 'http://'.$_SERVER["HTTP_HOST"].APP_DIR);

      and use "APP_FULL_U RL" 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?

      Comment

      • Paul

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

        ALl good thoughts - I'll give them a try - many thanks


        Comment

        Working...