Page 1 of 1

Where Should I Put the "www" and "cgi" Folders?

PostPosted: 29. August 2009 15:59
by TDinDC
Having successfully installed and tested the components within XAMPP, I now want to begin testing some of the web pages I've authored that have SSI, use PHP scripts and will access a MySQL database. I'm completely new to all this (I simply let XAMPP do the configuration and answered the questions on the command line to the best of my ability - thank God it didn't present a bible for me to swear on before answering the questions :D . I was reading an article at http://www.devshed.com/c/a/Apache/Configuring-and-Using-the-Apache-HTTP-Web-Server-on-a-Windows-XP-PC/1/ which made the following statements:

Additionally, you need to at least make some minor changes to the configuration file in order to enable SSI includes and CGI, which of course, you want to do (don’t you?)

But first a little groundwork; in the My Documents folder, create a folder called My Website, and within that, create a folder called localhost. Now create two folders in the localhost folder; one called www and one called cgi. That’s your directory structure set up.


I should say, first, that I normally don't use the My Documents folder for anything other than what Windows prefers to store there (and, frequently I even redirect those files.) The website I'm developing lives on another partition\folder: J:\webroot, which Windows recognizes as a web folder. Inside that live all my web pages and subfolders like \databases, \scripts, \css, \images, \includes, etc. The XAMPP folder structure is in yet another partition: K:\ (I have setup my drives to separate/partition different classes of applications and data, which are numerous.)

So, my questions are the following:
(1) Is the quoted article accurate?
(2) If so, where, in relation to the J:\webroot folder do the folders referred to go? (This is somewhat confusing, because, even though I assume that his "My Website" folder equates to my J:\webroot folder, I thought that localhost was configured in the \Windows\System32\drivers\etc\hosts file and simply gave an IP address for localhost.)
(3) Do I also need to modify the hosts file? If so, how?
(4) Do I need to modify any configuration files within XAMPP? If so, which ones and which directives, etc.?
(5) Finally, is there anything else I'm not knowledgable enough to ask but need to attend to?

Thanks in advance for any help.

TDinDC

Re: Where Should I Put the "www" and "cgi" Folders?

PostPosted: 29. August 2009 23:07
by dmphotography
TDinDC wrote:Having successfully installed and tested the components within XAMPP, I now want to begin testing some of the web pages I've authored that have SSI, use PHP scripts and will access a MySQL database. I'm completely new to all this (I simply let XAMPP do the configuration and answered the questions on the command line to the best of my ability - thank God it didn't present a bible for me to swear on before answering the questions :D . I was reading an article at http://www.devshed.com/c/a/Apache/Configuring-and-Using-the-Apache-HTTP-Web-Server-on-a-Windows-XP-PC/1/ which made the following statements:

Additionally, you need to at least make some minor changes to the configuration file in order to enable SSI includes and CGI, which of course, you want to do (don’t you?)

But first a little groundwork; in the My Documents folder, create a folder called My Website, and within that, create a folder called localhost. Now create two folders in the localhost folder; one called www and one called cgi. That’s your directory structure set up.


I should say, first, that I normally don't use the My Documents folder for anything other than what Windows prefers to store there (and, frequently I even redirect those files.) The website I'm developing lives on another partition\folder: J:\webroot, which Windows recognizes as a web folder. Inside that live all my web pages and subfolders like \databases, \scripts, \css, \images, \includes, etc. The XAMPP folder structure is in yet another partition: K:\ (I have setup my drives to separate/partition different classes of applications and data, which are numerous.)

So, my questions are the following:
(1) Is the quoted article accurate?
(2) If so, where, in relation to the J:\webroot folder do the folders referred to go? (This is somewhat confusing, because, even though I assume that his "My Website" folder equates to my J:\webroot folder, I thought that localhost was configured in the \Windows\System32\drivers\etc\hosts file and simply gave an IP address for localhost.)
(3) Do I also need to modify the hosts file? If so, how?
(4) Do I need to modify any configuration files within XAMPP? If so, which ones and which directives, etc.?
(5) Finally, is there anything else I'm not knowledgable enough to ask but need to attend to?

Thanks in advance for any help.

TDinDC


1) For the author of that article, yes. But for those using XAMPP, no, unless you can translate what he's saying to apply to XAMPP.
There is good news though, the cgi-bin has already been configured on XAMPP.

YOUR CGI BIN
It is located in your XAMPP folder at the same level as the default htdocs folder, apache, etc. (I think it's the same on Windows, I'm no a Linux PC at the moment so I am going off of XAMPP for LInux.)
Your CGI bin is configured as an "Alias", which XAMPP uses for a few different things including phpmyadmin.
What this means is that no matter where you define your website's document folder at, localhost/thealias will still refer to the same place since in the alias it is defined by the document path and not the URL path. View your httpd.conf file in your Apache folder and search for cgi-bin. You should see where it's defined there.
You will also see that it's enabled here because by default, it loads the cgi module.
The other Aliases are defined in /extra/httpd-xampp.conf

(2) I've already explained the cgi-bin has been defined. You don't need to alter this, no matter where you put your webroot folder. The important thing is you define your DocumentRoot as your webroot folder location so that it's accessible when you go to http://localhost/
Your cgi bin will be located at http://localhost/cgi-bin/ regardless where your DocumentRoot folder is located.

3) YOUR HOSTS FILE
There should be no reason for you to modify this, especially if you don't understand what it does.
It basically is telling your computer localhost equals 127.0.0.1, which is every computer's internal default local IP address.
This has nothing to do with what you're trying to do.
I've written an article on using this and how to use it if you want to know more about it:
http://www.myownserver.info/home/step-4-additonal-settings/20-fakedomains.html

4) Nope.

5) You can browse my website for several different things I've taken the time to explain regarding XAMPP and Apache.

My primary focus is geared towards installing server software and add-ons, so I haven't went extremely deep into configuration settings, but I did take quite a bit of time to explain a lot of the more common functions and configurations for those getting started.

I hope this helps you.