Problem getting cgi script to work with apache?
Simon Andrews
simon.andrews at bbsrc.ac.uk
Tue Jul 11 12:01:26 UTC 2006
Gordon Messmer wrote:
> Knute Johnson wrote:
>>
>> No it was almost twice as many lines. But I think that is where the
>> problem is. Another fellow suggested that I try dos2unix and that
>> makes a file exactly the same size as the VIM copied one that works.
>> I just tried it and that has fixed my problem. I had no clue that
>> perl was sensitive to carriage returns.
>
> As far as I know, it's not. The problem you run in to is that the
> kernel *is* sensitive to CR in the shebang. If the first line of your
> file is:
>
> #!/usr/bin/perl\r\n
>
> ...then the kernel will try to exec "/usr/bin/perl\r", which doesn't
> exist. Naturally, as a kernel issue, this affects all scripts,
> regardless of the interpreter used.
..which is why it's a good idea to always use:
#!/usr/bin/perl --
..as the shebang line, which won't get messed up by any combination of
line endings.
Simon.
More information about the users
mailing list