SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Virtual host questions

    When you are adding a line to the host file like this

    127.0.0.1 localhost mywebsite
    And by telling the httpd-vhosts.conf file what line you added to the host file what is going on ?


    Have you set the include path in the php,ini to point to the right place(s)? The section in the php.ini will look like:

    ;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;

    ; UNIX: "/path1:/path2"
    ;include_path = ".:/php/includes"
    ;
    ; Windows: "\path1;\path2"
    include_path = ".;c:\php\includes;c:\php\example"

    Add one for each web app, separating them with a ;
    Do you have to worry about this and what does this relate to with client request ?

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adding a host to the hosts file tells your system what IP it should connect to when asked to connect to the hostname. In this case you are telling that for localhost and mywebsite the IP address is 127.0.0.1. This IP address is so called loopback mechanism, which means that any traffic sent to that IP is sent to the very same machine which sent it (your own machine).

    Adding a hostname to Apache VirtualHost configuration tells Apache how a request for the hostname should be handled. For instance you can specify which directory should be the document root for the requests (from which directory it should serve files).

    include_path directive is PHP-specific and has nothing to do with client requests.

  3. #3
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adding a host to the hosts file tells your system what IP it should connect to when asked to connect to the hostname. In this case you are telling that for localhost and mywebsite the IP address is 127.0.0.1. This IP address is so called loopback mechanism, which means that any traffic sent to that IP is sent to the very same machine which sent it (your own machine).
    Are you saying that you can also used http://localhost/mywebsite ?
    How come if your using a virtual server like XAMPP the path name is not http://localhost/XAMPP/<whateverdirectory> in my case it's http://localhost/<whateverdirectory>

    Adding a hostname to Apache VirtualHost configuration tells Apache how a request for the hostname should be handled. For instance you can specify which directory should be the document root for the requests (from which directory it should serve files).
    I don't understand.

    include_path directive is PHP-specific and has nothing to do with client requests.
    What does it have to do with, I took some parts from another thread so I want to understand.

  4. #4
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look for something similar to this in your vhosts config file

    <VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot "C:\path\to\www"
    </VirtualHost>
    This gives "localhost" a directory to go to when you type it in the address bar.

    Since you added "mywebsite" to your host file you need to give it a directory as well. Just add this to the end of your vhosts config file.

    <VirtualHost 127.0.0.1>
    ServerName mywebsite
    DocumentRoot "C:\path\to\www\mywebsite"
    </VirtualHost>
    So, "mywebsite" is the request and "C:\path\to\www\mywebsite" is the directory that serves the files for that request.
    No, I REALLY dislike having to use Joomla.

  5. #5
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where do I find my vhosts config file ? Are you saying that I can change
    where currently have to go to http://localhost/test I can change that in the vhost config file ? And if so I'm a bit lost where the host file comes into all this?

  6. #6
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's the httpd-vhosts.conf file you mentioned in your first post. You can use your computer's search program to find the file.

    If you're using XAMPP, Google "virtual hosts xampp"...there are plenty of walkthroughs out there.
    No, I REALLY dislike having to use Joomla.

  7. #7
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright I'll do a little google reading And I found the file so thank you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •