Hi, Yes, you've confirmed my diagnosis: when I tested by sending a script from my Windows machine to a Linux machine in binary transfer mode (failing to convert line endings), and executed it as a CGI script, my browser told me I have an internal server error, and my apache error log told me I've had a "premature end of script" error. That's the sort of error you see, when the script terminates before the HTML header is output. I tested without the -w switch first. When I added back in the -w switch, all was ok. There is a reason for that; without the -w switch, the operating system thinks your shebang line is requesting /usr/bin/perl\r (perl\r being an invalid command name).
The point being, that my assessment of your problem is probably accurate. If you are, as you say, transferring in ascii mode, and line endings are still failing to be converted, that's an additional problem with your FTP or PSFTP software. I'd check into that. But in the meantime, get into the habbit of, immediately following your file transfer, executing "dos2unix filename.cgi" on your remote server. It's as important as remembering to set file permissions.
Humor us and try the dos2unix program to convert your line endings.
| [reply] |