Hi there!

Thanks for trying to use my tutorial - I'm sorry you're having trouble getting it to work.

There are no typos in the code I posted - it should work "as is". I think your problems are due to differences in your file names, directory structures, web server config, etc. I'll try to clarify as much as possible.

For starters, I'm running Ubuntu linux (any debian based linux should be similar). If you're trying to run under windows... it *should* work, but I haven't tried it, and I'd recommend you switch to linux!

For starters, my apache config file has the following:

DocumentRoot /var/www/public_html/

This means if you put a simple hello_world.html file inside /var/www/public_html you should be able to see it in your browser if you use the URL

http://mydomain.com/hello_world.html

You may have to "chmod 644 hello_world.html" to make it readable.

My apache config file also has this in it:

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
This means I can put scripts inside the /var/www/cgi-bin directory (for example, /var/www/cgi-bin/hello_worl.pl) and access it with the browser using a URL like:

http://mydomain.com/cgi-bin/hello_world.pl

You may have to "chmod 755 hello_world.pl" to make the script work properly.

My apache config also has this:

AddHandler cgi-script .pl

If you don't have this, then your scripts may have to end in .cgi instead of .pl.

I'd suggest creating simple "hello world" files and making sure that you can get at least that much working - else there's no use going any further.

Assuming you can get that much to work, let's take a closer look at my tutorial:

All paths are relative to a working directory of "/var/www/cgi-bin". For example, My WebApp directory is actually "/var/www/cgi-bin/WebApp". For simplicity, I didn't add the "/var/www/cgi-bin" to the front of everything, and in theory you could actually put it somewhere else - but you'd have to modify your apache config accordingly. The file structure under WebApp looks like this:

WebApp
  | 
  |-simple.pl
  |-simple.ini
  |-libs
  |   |-MyLib
  |       |-Simple.pm
  |       |-Login.pm
  |-templates
      |-index.html
      |-default.html
      |-login_form.html

All the directories should be chmod 755, all the files chmod 644 - except simple.pl, which should be chmod 755, and simple.ini, which should be chmod 600.

I'm concerned that you didn't follow these instructions exactly as written because in your question you referenced "WebApp/Simple.pl" instead of "WebApp/simple.pl" - this stuff is case sensitive - so it will make a difference.

I'm also concerned because in the info you posted it looked like you were putting files under "/home/username/public_html/cgi-bin" - if you want to change the file structure you really need to know what you're doing. For example, everywhere I have /var/www/cgi-bin, you'll have to change it to /home/username/public_html/cgi-bin, etc. By the way, putting your scripts under your document root is a bad idea, from a security point of view... but that's a whole different topic...

You can check each part by using "perl -c" to check for syntax errors. It will also let you know if it can't find a library. So do something like this:

cd /var/www/cgi-bin/WebApp/libs/MyLib perl -c Simple.pm perl -c Login.pm cd /var/www/cgi-bin/WebApp perl -c simple.pl

You may need to install a module or two if you're missing something. If you install them using "sudo cpan" then everything should "just work". If you install modules into a custom locations, for example "~/libs", then you'll have to add a "use lib '~/libs';" to any .pl or .pm file that needs a module installed in the "~/libs" directory.

Okay - this post has gotten pretty long, so I'm going to stop for now. Give these suggestions a try and let me know how it goes. If you're still getting errors, provide more info and I'll take another look.


In reply to Re: Authentication Script Path Problems by scorpio17
in thread Authentication Script Path Problems by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.