1836579 Members
2071 Online
110102 Solutions
New Discussion

"perl: cannot execute"

 
JI HUI
Frequent Advisor

"perl: cannot execute"

Three perl script application were running on a HP-UX 10.20 machine. When tried to start another perl script, "perl: cannot execute" was shown. The message was shown even for a "perl -v" command. the permission setting was correctly with "x". After killing the three processes. It becames OK.

Any one know what would be possible cause of the problem. Thank you
Nothing is everything
12 REPLIES 12
Sandor Horvath_2
Valued Contributor

Re: "perl: cannot execute"

Hi !

1.
Check again the first line in your script

#!/usr/bin/perl

Check /usr/bin/perl is exist and executable.

2.
Try start it in a different shell ( csh ) and may be found the mistake.

Saa
If no problem, don't fixed it.
CHRIS_ANORUO
Honored Contributor

Re: "perl: cannot execute"

Increase the kernel parameter maxusers value. This is a macro that will increase some other values like nfile and nproc , etc
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Victor BERRIDGE
Honored Contributor

Re: "perl: cannot execute"

Hi,
Were you always executing the scripts as the same user?, there is a kernel parameter: maxuprc - maximum processes per user - you may have reached...
Increase its value and try again...
Good luck

Victor
JI HUI
Frequent Advisor

Re: "perl: cannot execute"

Hi, thank you for you prompt reply.

I did check the processes run by the user by "ps -ef |grep user_id", less than 10 processes were shown under this user id. and maxuprc was set to 256.

I even could not start "perl" as well even I logged in as "root", but I could other program, such as sam, sar.

Any suggestion what may go wrong?

Another question: how to log the number of processes which was run by a particular user?

thank you.
Nothing is everything
Steven Sim Kok Leong
Honored Contributor

Re: "perl: cannot execute"

Hi,

Your script is not running the perl interpreter from the correct path. Please check that your perl executable resides in the path specified in the first line of your script.

If your script calls the perl interpreter from /usr/bin, then your script would reflect in its first line: #!/usr/bin/perl

To resolve this problem, either modify the path in your perl script to where your perl interpreter resides eg. change #!/usr/bin/perl to #!/usr/local/bin/perl, or copy/soft-link your perl interpreter to where it should reside
eg. ln -s /usr/local/bin/perl /usr/bin/perl

Hope this helps. Regards.

Steven Sim
Brainbench MVP for Unix Admin
http://www.brainbench.com
Steven Sim Kok Leong
Honored Contributor

Re: "perl: cannot execute"

Hi,

To count the number of processes run by a specific user, run the following command to minus off the single line count for the heading: # expr `ps -fu $userid|wc -l` - 1

Hope this helps. Regards.

Steven Sim
Brainbench MVP for Unix Admin
http://www.brainbench.com
Dan Hetzel
Honored Contributor

Re: "perl: cannot execute"

Hi,

Could you check which program you start when typing 'perl -v'.
At the prompt, type 'which perl'
It could show that you have a file called 'perl' in your PATH, especially if your PATH includes the current directory (.)

What happens if you type '/usr/bin /perl -v' or '/usr/local/bin/perl -v' (depending of your installation directory) ?

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
JI HUI
Frequent Advisor

Re: "perl: cannot execute"

I had even "cd" to the directory where the "perl" is located and tried to start it with "perl -v". But it failed.
Nothing is everything
Dan Hetzel
Honored Contributor

Re: "perl: cannot execute"

Hi,

As the modification date of your perl executable been changed recently?
What is the output of 'what /usr/bin/perl' ?

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Dan Hetzel
Honored Contributor

Re: "perl: cannot execute"

Oops, typo....

Should read "Has the modification...."
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Steven Sim Kok Leong
Honored Contributor

Re: "perl: cannot execute"

Hi,

If you are not able to run perl from the perl -v from the directory containing the executable, Please check your PATH settings. Your current directory should be in your PATH settings.

Try either:

$ PATH=$PATH:.
$ perl -v

Or:

$ ./perl -v

Hope this helps. Regards.

Steven Sim
Brainbench MVP for Unix Admin
http://www.brainbench.com
JI HUI
Frequent Advisor

Re: "perl: cannot execute"

Just to clarify,

I did tried "./perl -v" as well at the directory where perl executable is installed.

As I mentioned in my first message, without changing anything, just killing the three processes, I can start "./perl -v" or "perl -v" and any perl script.

Really hope to get a clue what may go wrong.

thank you for those who has give me suggestion
Nothing is everything