LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why cant i execute a perl script (https://www.linuxquestions.org/questions/linux-newbie-8/why-cant-i-execute-a-perl-script-152751/)

dude4you 03-02-2004 04:42 PM

Why cant i execute a perl script
 
When I try to execte my script I get following error:

[root@ scripts]# su cactiuser perl unix_apachestats.pl localhost
perl: /usr/bin/perl: cannot execute binary file

I also tried

[root@ scripts]# su cactiuser unix_apachestats.pl localhost
unix_apachestats.pl: /bin/bash=/bin/bash: No such file or directory
unix_apachestats.pl: =/usr/bin/lynx: No such file or directory
unix_apachestats.pl: =/usr/bin/head: No such file or directory
unix_apachestats.pl: my: command not found
unix_apachestats.pl: chomp: command not found
unix_apachestats.pl: line 34: syntax error near unexpected token `{'
unix_apachestats.pl: line 34: `if ($hostname eq '') {'

vimico 03-02-2004 05:31 PM

In order to narrow the possible sources for this error, it might be a good idea to check the system log file, to see if there is a more detailed error message.

In a Debian system this file is located at /var/log/messages

Shortly after reproducing the error, display the newest lines in this usually very long file by typing:

Code:

tail /var/log/messages
(You need be root to have access to that file).

flynhi66 03-02-2004 05:50 PM

try su - cactiuser perl unix_apachestats.pl localhost

su by itself does not set environment variables needed by this script. call it with su - (the minus runs the environment scripts and sets the variables)..


All times are GMT -5. The time now is 08:59 AM.