Perl Script getting Premature End Of Script Headers Error

Assume that you have a sample Perl script that only print the clear text and you still got the premature end of script headers error.

Sample Perl Script used.

print “Content-type: text/html\n\n”;
print “Hello, Mick Genie!\n”;

Step to overcome the problem.

1. Check the Apache error_log or domain error log.
2. Check if the perl script come with permission 755 where this will allow the script to execute.
3. Check the suexec.log from your Apache log.
4. Upload your Perl script in ASCII mode.

Once you have done the above step and still get the same error, follow the step as below to track the perl error.

1. Tracking the error from script.

perl -wc

This will allow you to check if there is syntax error.

2. Track error without syntax error.

perl -w

Published by

Mick Genie

Mick Genie is the founder of and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.