• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

running perl

Hello i have installed redhat linux 5.2 on a pentium 155

in my home directory i have created a cgi-bin and chmod 755 in here i have a test.cgi also chmod 755 but it wont run only shows the source in my browser.

running perl -c test.cgi on command line shows syntax ok and running perl -w test.cgi gives the required output .
why will it not run using netscape?? I am logged in as root.
0
wampy
Asked:
wampy
  • 2
  • 2
  • 2
1 Solution
 
mgoergenCommented:
In which Home Dir? Home Dir of the html or your local home?

Check the settings of the Webserver perhaps there is a "virtuell Dir" defined called cgi-bin. In that case you could edit the path or copy the script.

is the path of the perl compiler right (Insite the script!)

Normaly
#/usr/bin/perl

0
 
biardCommented:
Actually, its

#!/usr/bin/perl

Must have hashbang.  Also you should be able to run the script without the perl command if the hashbang line above is entered correctly.  You can just enter the script name at the command line if its location is in your path.  If not, just type ./perlscript  where perlscript is the name of your file.  If this works, the command in the first line of your script is correct.  If not, you need to find the perl executable's path.  Do this by typing

which perl

at the shell prompt.  Then modify the #! line at the top of your script with the correct path.

Good luck
0
 
wampyAuthor Commented:
ok thanks ive got the perl path right.
and the top line right

im trying to run in /home/gerald/bin

gerald is my home dir

I dont know how to tell if i have a virtual directory
 "virtuell Dir"  defined called cgi-bin.

my test.cgi runs through the command line but the browser is still showing the source code and not running it.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
biardCommented:
Two things to try.  First, try changing the name of the file to test.pl instead of test.cgi.  If that fails, then run linuxconf.  Look for Apache Web Server section.  In the defaults subsection is a setting for "may execute cgi".  set that, quit, activate changes.  After exiting, try again to run you app.
0
 
mgoergenCommented:
So things getting clearer now.

You want to view the perl script over a web browser. Are you sure that your Server reach your Home Directory? I guess he doesn´t try to copy your script into the server cgi-bin It should be
/usr/local/httpd/cgi-bin or s.th. like that. Check also the ownership Normaly it should work under wwwrun (Be sure that you have a user account with that name). If it works you can modify the serverconf. file.
0
 
wampyAuthor Commented:
ok thanks guys seems ive got to go back a step or two and get some basics right anyway im really happy with my linux box so far ive discovered window maker and lots of other stuff.
gee windoze sucks.
Happy new year to everyone from New Zealand
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now