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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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!)


Actually, its


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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Two things to try.  First, try changing the name of the file to 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.
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 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.
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.