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

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
0
ttrogden
Asked:
ttrogden
1 Solution
 
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
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.

 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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