SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help please. Two site folders in wamp www folder. Includes aren't connecting.

    Hello. I hope that you are well and enjoying life in general.

    It was recommended that I bring my situation to this forum. Yes I did search and read a lot of posts but I don't think that I found anything that addressed this specific problem. Or if I did I didn't understand it well enough to recognize so.

    Let me preface this by saying that I am not smart enough to understand most of the responses in these forums, so you have to really gear it down for me...

    I have a good working site with an index on each page, carried in as an include. I did it like this, from the advice from a forum:

    <div id="rantlet_index">
    <?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/selector01.php"; ?>
    </div> <!--end rantlet_index-->


    It looks like this, the index being the column on the left:

    appearance_on_the_web.jpg

    It runs fine out in the world at the web provider. It ran fine internally on my computer via wamp when the site was the only thing in wamp's www folder.

    Wanting to start another site and develop it internally via wamp, I used assorted instructions from the web to create two folders inside the wamp's www folder, each carrying its own site.

    The index.php files open fine in Chrome from each folder but the includes are not included:


    faulty_internal_rendition.jpg

    Somehow wamp can display the sites in the folders inside the www folder, but it can't follow the includes.
    I've fiddled with this for as long as I could think of things to try, but that's not much because of my limitations.
    Does anyone have any ideas that might make this work?

    Thanks

    Pseu
    Attached Images Attached Images

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    I think your problem is that the root folder on your local machine is not the same as on your web host. So you have two options:

    1. change the include path on your local machine to point to where the files are located
    2. configure Apache on your local machine to work like the web host does.

    The second way is a little more complex, but not too hard; and its advantage is that you don't have to change anything when you upload your code to your web host. Here is a little tutorial on how to set things up on Windows:

    http://foundationphp.com/tutorials/apache22_vhosts.php

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Ralph seems to have the right approach but a simple reminder might help you: Using WAMP (or any other canned app like it), you must stay within the localhost directory (www) for files to be available (as links)

    The only exception to this if you modify the config/httpd.conf to include config/extras/httpd-vhosts.conf, the config/extras/httpd-vhosts.conf and your system32/drivers/etc/hosts file to create a virtual host (then restart Apache) for your different "websites". If that sounds like too much work, stay within the www directory!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Ralph seems to have the right approach but a simple reminder might help you: Using WAMP (or any other canned app like it), you must stay within the localhost directory (www) for files to be available (as links)
    So in wamp, if I want to create multiple sites, I put each site's folder inside the wamp/www folder? That's what I did, but apparently there's more to it than that...


    The only exception to this if you modify the config/httpd.conf to include config/extras/httpd-vhosts.conf, the config/extras/httpd-vhosts.conf and your system32/drivers/etc/hosts file to create a virtual host (then restart Apache) for your different "websites". If that sounds like too much work, stay within the www directory!
    I think that that's what I did with the first three online methods that I tried, although I can't guarantee that what they were telling me to do is exactly the same as what you're mentioning.

    I'll try the foundationphp.com method that Ralph referred this weekend. They say to make the folder that holds the virtual hosts to be at the top of the pile; c:/folderthatholdsthevirtualhosts . I guess with wamp I shouldn't do that?

    MP

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    MP,

    With VirtualHosts, you can put the DocumentRoot of the VirtualHost anywhere you want. Obviously, they won't work as localhost so be sure that you don't use a valid domain name, e.g., I use:

    Code:
    # httpd-vhosts.conf
    <VirtualHost 127.0.0.1:80>
    ServerName dk
    DocumentRoot W:/DK
    ServerPath W:/DK
    </VirtualHost>
    
    # hosts
    127.0.0.1 DK
    Be sure to run your text editor in administrator mode (Windows) for the hosts file, Apache's httpd-vhosts.conf (and enabling code in the httpd.conf), too, if they're in a Windows protected directory.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post

    Be sure to run your text editor in administrator mode (Windows) for the hosts file, Apache's httpd-vhosts.conf (and enabling code in the httpd.conf), too, if they're in a Windows protected directory.
    Whoa, now this is something I've never heard of...
    Could this be something that all these sites with all these instructions just don't mention?

    How do I tell the difference if the text that I write appears in the files just like any other text?

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Mp,

    That's been a major PITA since Vista came out. However, that's a good reason to install Apache (et al - except MySQL which runs as a service) in directories other than Program Files and Windows. It was a well-kept secret (that M$ was finally taking security seriously?) and sure made me change my locations.

    How can you tell? Save then reopen and see whether the text was saved.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I went through the procedure outlined at
    http://foundationphp.com/tutorials/apache22_vhosts.php
    step by step, inch by inch....and it still cheerfully continues not to work.

    I have to think that this is some php thing that makes it work in
    wamp\www\somefile.php but not in wamp\www\somefile\somefile.php .
    The site works at the web provider in the Internet.
    The site works when it is in wamp\www .

    The page displays but the php index on the page does not.

    . . . . . . . . . . .


    I have tried to understand dots and slashes many times, but I am not up to it.

    Is there anything about moving everything to another folder that would short out this

    from_the_html.jpg

    . . . . . . . . . . .


    Is there some wamp setting that nobody has thought of?

    . . . . . . . . . . .

    Oh, I'm in Windows XP sp3. I still haven't heard a reason not to be.

  9. #9
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Mp,

    I don't know about WAMP but, with the real daemons, you'd simply edit httpd.conf to include the extra/httpd-vhost.conf file (it should be commented out at the end), edit the extra/httpd-vhost.conf file to include your localdomain (as above) and edit your Windows/system32/drivers/etc/hosts file (as Administrator) to include 127.0.0.1 localdomain (for each of your localhost's virtual domains) and restart Apache. It should be the same with WAMP.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  10. #10
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, yeah.
    That's what everyone has been saying all along.
    That's what I've been doing all along, four ways following four people's sites including foundationphp.
    That's what hasn't been working all along.

    Maybe I'm opening the file incorrectly?
    What should I be typing into the browser to open the internal site?

    P


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
  •