×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Confusion with paths

Confusion with paths

Confusion with paths

(OP)
I'm "requiring" a file into my Perl scripts that contain paths and other setup information. I am trying to NOT have to specify a full path so it will work as well on my Windows NT PWS as it does on the Unix server.

The "required" set up file is in my cgi-bin with other scripts in directories under it.  If I require it using a path like "../setup.pl" Perl can't find the program, but if I use "cgi-bin/setup.pl" it can. I can't figure out why it works the second way and not the first since the scripts are in subdirectories!  Any clues?  Is there a better way of doing it short of specifying the whole path, which defeats what I am trying to do?  Thanks!

Don

RE: Confusion with paths

I use the documnt root variable:

$infile = "$ENV{'DOCUMENT_ROOT'}/directory/infile.txt";

I don't know if it will work on NT though.  Probably not :)

fortytwo
will@hellacool.co.uk
my test site

RE: Confusion with paths

(OP)
Thanks!  It's worth a try, which I will do tonight. I had tried variations on a CWD script but it gives the path of where the script was located, but I couldn't figure out how to make it "back up" a directory to give the path to where the setup file is located.

Don

RE: Confusion with paths

(OP)
Sadly, it does not seem to work on the NT system. I've tried accessing the IIs documentation but was not able to do so.

Don

RE: Confusion with paths

Relative paths should work.  if I want to go from (for example) the directory test:

            root
              ¦
              ¦
        -------------
        ¦           ¦
       test      cgi-local

to the directory cgi-local I would use ../cgi-local/filename.txt

fortytwo
will@hellacool.co.uk
my test site

RE: Confusion with paths

(OP)
Strangly enough, the relative path works on the Linux Web server but not on PWS on my NT system.  That's what I meant when I said I needed to remove the ../ for it to work even though there are directories above the cgi-bin but then it won't work on the linux server.  Having to change it each time is defeating the purpose. I can't see why it doesn't work.  I think if I could get Apache working with Perl on NT, they would be closer to each other in functionality but alas, I can't seem to do it.  PWS is rather limited.

Don

RE: Confusion with paths

I think it should be possible to install apache and perl on NT.  I have copied the instructions for doing it that are taken from the advanced user guide of the actinic gatalog (actinic.co.uk).  I hope it is of some help:

How can I set up Catalog on my Laptop?
To install a standalone Catalog system (that does not require connection to the Internet) on a laptop or any PC running NT or Win'98 you will need the following components:

Program    Can be downloaded from    Filename
Apache Web Server    http://www.apache.org/dist/binaries/ ;   apache_1_3_12_win32.exe
ActivePerl    http://www.activestate.com/Products/ActivePerl/Download.html ;   Api522e.exe (or a newer version if available)
War-FTP Daemon    http://www.dukenukemcity.com/jgaa/downloadpage.htm ;   ward165.exe
The above file locations are correct as of July 2000.
Installing Perl
Download ActivePerl and run the Perl installer. A successful installation can be achieved by going with all the default settings in the installer.
Installing the Apache Web Server
Run the Apache installer and follow the defaults with the exception that the installation directory should be C:\Apache.
Before the web server will run you need to edit the file httpd.conf located in the c:\Apache\conf directory. Open it with Notepad and locate the line:
#ServerName new.host.name
and replace it with
ServerName localhost
This will create a web server at C:\Apache\htdocs which should now be able to start (using the 'Start Apache as console app' option on your Start Menu.) Once Apache is started, you can go to http://localhost/ on your browser to view the encouraging message of 'It Worked! The Apache Web Server is installed on this Web Site!'
Using Explorer, create a sub-directory 'acatalog' under 'htdocs'. Create directories called 'COM' and 'Actinic' and 'Catalog' under 'htdocs'.
Now you have:

  c:  +
      ¦
      +-- Apache
          ¦
          +-- htdocs
              ¦
              +-- acatalog
                  ¦
                  +-- COM
                        ¦
                        +--Actinic
                                ¦
                                +--Catalog
Installing and Configuring FTP
Note: These instructions are for War 1.70, which is the version available from JGAA at the time of writing.
Installation is fairly straightforward. Put the file ward165.exe into a temporary directory and run it. Then run the setup.exe program that it unpacks. Accept the defaults, and run the War daemon from the 'Start' menu.
Then you need to create a user. Double click on the War logo in the System Tray (bottom right-hand corner of your screen) and it will bring up the configuration interface. Select the menu option: ‘Properties ¦ Security ¦ Edit User’ and then click ‘Add’ in the left panel.
 Create ‘demo’ as a user. Set up a log-in password. This will need to be secure since, if your laptop is ever connected to the Internet, it could potentially open up a hole in your computer security if you have a guessable password.
Select the ‘File access’ tab and click ‘Add’ in the path part of the tab. It prompts you with 'C:\' so navigate to ‘C:\Apache’ and hit ‘OK’.
You need to set permissions explicitly - the default grey ticks don't actually work. Set permissions to ‘Read’, ‘Write’ and ‘Delete’ but not ‘Execute’. Allow ‘List’, ‘Create’ and ‘Remove’. Check ‘Root’ and ‘Home’ and ‘Recursive’ but clear ‘Deny’ and ‘Mapping’.
Now click ‘Add’ again, select ‘C:\Apache\cgi-bin’ and this time allow ‘Read’, ‘Write’ and ‘Delete’ and ‘Execute’. Do not change any of the other settings.
Start the server by clicking on the lightning bolt in the top left corner. Then minimise the War FTP interface.

fortytwo
will@hellacool.co.uk
my test site

RE: Confusion with paths

(OP)
I have both Apache and ActivePerl installed, and even tried a special build that had both Apache and Perl in it, though I am not using Apache at the moment.  Apache and Perl are both easy to get working, but I can't get Perl to work in the Web browser, only from the command line.  I'll look through the material you sent in detail to see if there is a clue. (I like your user name, by the way. Even here in the U.S., we know what it means.)

Don

RE: Confusion with paths

(OP)
Long after I had given up on finding the problem as to why paths were different between my PWS IIS and the Linux Web server, I discovered the solution.  It seems that the build of Perl I was using, which was the latest but compiled into a binary of Apache, was apparently missing something that it needed to handle paths properly.  Once I removed it and reinstalled the "real" ActivePerl, the paths are much closer to being the same and in many instances I can use a little "cwd" routine to make the paths more dynamic.  Relative paths seem to work more consistantly too.

Still haven't gotten Perl working with Apache though.  It's as though Perl doesn't exist except from the command line, but it works fine with IIS.  Still need to try some more of the tips from fortytwo and others though.  I'm sure it's something easy that I'm missing.

Don

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close