Server error 500 on simple perl script

I just set up web space and I uploaded a simple perl script as recommended in the docs. I also have set permissions as recommended and I have a .htaccess file with Options +ExecCGI.

I have the same thing set up on another server and with IE8 it tries to download the file and on Firefox it juat displays the source text.

I can use telnet to execute the script on that server and it appears to be printing the correct header and text. But I can’t connect to the server.



What does the script look like? (In particular: does it print at least one header line?)

Here is the text of the script:

use CGI;
my $query= new CGI;
print $query->header;
print “hello people in my head\r\n”;

When I run it in telnet it prints out

Content-Type: text/html; charset=ISO-8859-1

hello people in my head

I also made a script called, which writes to a file. The script is:

use strict;
use warnings;
use CGI;
my $query= new CGI;
open my $out, ‘>’, “output.txt” or die “File error: $!”;
print $out $query->header;
print $out “\r\nHello, World.\r\n”;
close $out;

And the file contents are as above. But this is on my server. With the dreamhost server, If I try to run either script on IE8 or Firefox I get the server error. The error logs are something like this:

suexec failure: could not open log file
fopen: Permission denied
Premature end of script headers:
File does not exist: /home/pes1949/
suexec policy violation: see suexec log for more details
Premature end of script headers:
File does not exist: /home/pes1949/

When I used chmod 755 the error changed to the same as for AFAIK everything is the same in and dreamhost.

The semicolon at the end of the first line of screws things up. So does having DOS-style line endings. Fixing both made the script work., as written, will not work as a CGI script, as it doesn’t actually generate any output. (The fact that it’s writing to output.txt doesn’t count.)

I was amazed that it works. But if I copy the file to another (such as and set permissions 755, it works, but if I edit the file using either editor in net2ftp, it stops working. Can I access a compatible editor? I tried sending the command “pico” but it was not recognized as an FTP command. And I can’t use Telnet. So how do I edit a perl script without DOS-style line endings?