Perl/cgi problem

I'm having a problem with my new Linux Install.  When i try to run a cgi or .pl file i get bad command - but when i type /usr/bin/perl file namke it works - i've got #!/usr/bin/perl at the top of my script - do i need to do something else ??  - I've granted the correct rights - i'm thinking i need to add something to the perl engine or something
LVL 1
ttrogdenAsked:
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.

HalldorGCommented:
and you have chmod the files to

755?

and you are running them with full path
or

../myscript.pl

 
0
ttrogdenAuthor Commented:
yes - i know the permissions are right cause when i type in /usr/bin/perl <filename.pl> it works - it's just when i try to run the script <filename.pl> that it doesn't work.  Am I suppose to setup something in Apache to look for cgi/.pl scripts????


tommyt
0
drittichCommented:
Apache doesn't come in to play when you run a Perl script from the command-line (unless the script is calling it of course).  When you are in the directory that contains the script, try

../filename.pl

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

helverCommented:
Who is the script owned by?  Who does httpd run as?  What are the permissions on all the directories down to the one with the script?

try su'ing to the apache user, and running the script using the full path to the script...
0
drittichCommented:
I thought HalldorG had typed two periods, but I see experts-exchange (!) replaced my one period with two as well.  It should be

single period/filename.pl
0
AstromanCommented:
a script doesn't need to be executable to be run using:

/usr/bin/perl script.pl

as you are only passing the script as an argument to the executable 'perl'.

What has apache got to do with this, are you trying to set up a cgi perl script - if you are you need to set up cgi in the httpd.conf and the access.conf.

Finally, make sure your script is in you r PATH var or it won't execute unless you type in a full or relatice path to it.
0
adam923Commented:
i found that it's easier to tell apache to run as a specific user that you create and then make that user the owner of the scripts
0
patowicCommented:
'bad command'?  What's the exact error message?
0
lafor021199Commented:
I think your problem is the carriage returns. Try to open with emacs and then save it again.
I you use vi try with set filemode=unix

--julian
0

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
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
Linux

From novice to tech pro — start learning today.