SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Back to basics

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Back to basics

    Gudday all
    I find myself getting confused and have a few issues. My Apache knowledge is sparse (but getting better).
    At my work I am trying to introduce a trouble ticketing sytem onto a test XP system. Looking at a likely suspect it required Perl and Apache. I have installed both apparently successfully, Perl being v5.10 and Apache being v2.2.8.
    I unzipped the files for the application and got a lot of cgi and pm files.
    I had to modify the 1st line of all the cgi to have the Perl path correct.
    I made it
    Code:
    #!C:/Perl/bin/perl.exe
    to align with the path in Windows. Perl is installed in it's own directory under the root C: Hopefully this is correct.
    I loaded the application's cgi/pm files into the cgi-bin of Apache. Hopefully this is correct.
    I gave the directory and all users full permissions. See attachment. Hopefully this is correct.
    I have modified the Apache's httpd.conf as required (though I confess this is where some errors may arise).
    I used Mozilla to look at the application file called setup.cgi to begin the configuration.
    I saw the source code of setup.cgi. I know enough to realise that I have some sort of execution permission problems.
    My questions are
    1. Is Apache a service like IIS or a browser like Mozilla i.e. should I be opening an Apache browser (if possible)?
    2. Is cgi-bin (under Apache) the right location for these cgi & pm files. Unfortunately the installation notes are poorly written and not explicit enough.
    3. Are the permissions for cgi-bin correct for execution (assuming that pt. 2 is true)?
    4. Is the path for Perl correct?
    5. I may not set up the http.conf correctly. That will be hard to resolve and we may be able to avoid it.

    Any help greatly appreciated.
    Attached Images Attached Images
    ========================
    Carn the Tiges!
    www.petalsandpatches.com

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

    Oh, my! You're thrown me with selecting Perl but I have to assume that you're more comfortable with that than PHP.

    My questions are
    1. Is Apache a service like IIS or a browser like Mozilla i.e. should I be opening an Apache browser (if possible)?


    Apache is a daemon, i.e., a program that a browser interacts with. It IS like IIS but the two can only co-exist at different ports (IIS is selected by "Bill" while you can select Apache's at installation - and change it in the httpd.conf).

    2. Is cgi-bin (under Apache) the right location for these cgi & pm files. Unfortunately the installation notes are poorly written and not explicit enough.

    Yes and no. These become critical files which can (SHOULD) be kept OUTSIDE of your webspace (which, by default, is in Apache's httpdocs folder). Again, this is configurable within httpd.conf.

    3. Are the permissions for cgi-bin correct for execution (assuming that pt. 2 is true)?

    ONLY if they are existing outside the webspace should they be writable by anyone but you (as the system admin).

    4. Is the path for Perl correct?

    It does appear to be.

    5. I may not set up the http.conf correctly. That will be hard to resolve and we may be able to avoid it.

    Truer words were never spoken - except that it IS easy to edit the httpd.conf file and it is WELL documented (which makes it inordinately long).

    I trust that helped.

    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

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Tig,

    Oh, my! You're thrown me with selecting Perl but I have to assume that you're more comfortable with that than PHP.

    My questions are
    1. Is Apache a service like IIS or a browser like Mozilla i.e. should I be opening an Apache browser (if possible)?


    Apache is a daemon, i.e., a program that a browser interacts with. It IS like IIS but the two can only co-exist at different ports (IIS is selected by "Bill" while you can select Apache's at installation - and change it in the httpd.conf).
    I have left the port with the default Apache settings i.e. I did not alter it. IIS is not turned on on the server. Do I need to make any changes to http.conf? Do I need to specify a port for Mozilla i.e.
    Code:
    C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/<file_name>.cgi:<port number>
    ?
    Quote Originally Posted by dklynn View Post
    2. Is cgi-bin (under Apache) the right location for these cgi & pm files. Unfortunately the installation notes are poorly written and not explicit enough.

    Yes and no. These become critical files which can (SHOULD) be kept OUTSIDE of your webspace (which, by default, is in Apache's httpdocs folder). Again, this is configurable within httpd.conf.

    3. Are the permissions for cgi-bin correct for execution (assuming that pt. 2 is true)?

    ONLY if they are existing outside the webspace should they be writable by anyone but you (as the system admin).
    I guess I should rephrase the question to read "What changes, if any, need to be made to httpd.conf to have Apache treat cgi files as executable?" This would include paths for directories or files.
    Quote Originally Posted by dklynn View Post
    4. Is the path for Perl correct?

    It does appear to be.

    5. I may not set up the http.conf correctly. That will be hard to resolve and we may be able to avoid it.

    Truer words were never spoken - except that it IS easy to edit the httpd.conf file and it is WELL documented (which makes it inordinately long).

    I trust that helped.

    Regards,

    DK
    Thanks DK. We may have a few e-mails.
    ========================
    Carn the Tiges!
    www.petalsandpatches.com

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

    NO port required for any particular browser (unless you're using 8080 which would be :8080 after the domain name).

    Your code is wrong - no spaces UNLESS you enclose in quotes (as well as the misplaced port and URL?).

    I believe that Apache is ready for cgi-bin "out of the box" (with Perl being installed and something like mod_perl is added with a LoadModule - look for it in your httpd.conf and be sure it's not commented out).

    Also, be sure to search httpd.conf for cgi-bin as it is normally setup OUTSIDE the webspace so Apache must be told where to look.

    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

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    tig,

    NO port required for any particular browser (unless you're using 8080 which would be :8080 after the domain name).

    Your code is wrong - no spaces UNLESS you enclose in quotes (as well as the misplaced port and URL?).
    I am assuming that the code you refer to is the URL. I added &#37;20 in place of the spaces and still had the same result.
    Quote Originally Posted by dklynn View Post
    I believe that Apache is ready for cgi-bin "out of the box" (with Perl being installed and something like mod_perl is added with a LoadModule - look for it in your httpd.conf and be sure it's not commented out).
    When looking at the LoadModule section in the httpd.conf I can find the cgi one
    Code:
    LoadModule cgi_module modules/mod_cgi.so
    but no mod_perl. What would the line look like? There are a few possibilities.
    I have loaded Perl (v5.10) and it appears to be ok. I don't understand or know about mod_perl.
    Quote Originally Posted by dklynn View Post
    Also, be sure to search httpd.conf for cgi-bin as it is normally setup OUTSIDE the webspace so Apache must be told where to look.
    From my httpd.conf
    Code:
        #
        # ScriptAlias: This controls which directories contain server scripts. 
        # ScriptAliases are essentially the same as Aliases, except that
        # documents in the target directory are treated as applications and
        # run by the server when requested rather than as documents sent to the
        # client.  The same rules about trailing "/" apply to ScriptAlias
        # directives as to Alias.
        #
        ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
    The piece above is contained in the <IfModule alias_module> section.

    And also
    Code:
    #
    # "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #
    <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    
        AllowOverride None
    #    Options None
        Options +ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
    Those are the 2 locations where I could find /cgi-bin/

    AddHandler looks like
    Code:
        #
        # AddHandler allows you to map certain file extensions to "handlers":
        # actions unrelated to filetype. These can be either built into the server
        # or added with the Action directive (see below)
        #
        # To use CGI scripts outside of ScriptAliased directories:
        # (You will also need to add "ExecCGI" to the "Options" directive.)
        #
        AddHandler cgi-script .cgi  .pl

    Quote Originally Posted by dklynn View Post
    Regards,

    DK
    Thank you so far
    Last edited by Tigers!; Mar 27, 2008 at 16:42. Reason: More clarification given
    ========================
    Carn the Tiges!
    www.petalsandpatches.com

  6. #6
    SitePoint Zealot
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Argh!

    DK
    A chap at work and I were fiddling around and he got it to work i.e. we can see the required set up screen.
    He used
    http://localhost/cgi-bin/setup.cgi

    The question he and I have is why did that work and did not
    file:///C:Program%20Files/%20Apache%...-bin/setup.cgi
    work?

    (I told you that it was back to basics! )
    ========================
    Carn the Tiges!
    www.petalsandpatches.com

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

    'cause you're SUPPOSED to use the quotes (you are on a WinDoze system, aren't you?)!

    AND, /cgi-bin/ is in the /cgi-bin physical directory of the server.

    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


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
  •