Causes that can cause this error and methods of their elimination:
1. The first step is to check your .htaccess file in this directory and in the directories above. It should not contain php directives in itself. Incorrect contents of the .htaccess file can lead to this error.
It will not be superfluous to put a simple test.htm file next to the problem file and see if it loads. If it loads, then the problem is not in .htaccess and you should look further.
2. Then you need to check the rights to the file opened in the browser, as well as the rights to all the directories above. Usually they should be 755, 644, but not 777 in any case. To do this, you can also put a simple test.htm next to the script and try to open it – if it opens, then there is nothing wrong with the rights to the directories, you only need to check the rights to the file opened in the browser.
3. If you “catch” this error in a Perl/CGI file, check the path to Perl that you specify in the script. You can find the path to perl in your control panel.
Also remember that Perl/CGI scripts must be uploaded to the hosting in ASCII format and have the rights 755. Incorrectly set format in your FTP manager when uploading files and leads to this error.
5. If after checking if the rights set for the script file are correct, you should examine the last entries in the Apache error log file. You can view the log via the item in the control panel: “Settings/Statistics”.
If there is an error of the form:
“[Tue Jan 23 11:04:47 2007] [error] Premature end of script headers: /home/user/domains/domen.com/public_html/cgi-bin/test.pl”
The first thing to do when you get such an error is to check if the script gives HTTP headers correctly. Each script must first print a string with the appropriate Content-type and only then directly what the user sees (e.g., HTML code).
An example of a line to produce the header of a normal HTML document:
print “Content-type: text/html; charset=windows-1251”
These are the main situations that lead to this error. When you get this error, you just need to go through all the steps one by one and you are 99% likely to find the cause and be able to fix it. If you have checked everything, but still get this error, then contact our support team and we will take care of it 1%