• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

cgi-bin Script errors

C

catweasel

Guest
Hi,

I have recently moved my Dedicated Hosting to a company that uses Plesk, which I find works excellent for me.

However, I am having problems installing CGI Scripts. The permissions for the scripts are set correctly, but I receive "500 Internal Server Error" messages when I try and run the cgi installation scripts.

The cgi-bin has permissions of 750 (rwxr-x---), with the Owner set as 'Domain FTP User', and Group set as 'psaserv'.

The scripts have permissions of 755 (rwxr-xr-x), with the Owner set as 'Domain FTP User', and Group set as 'psacln'.

I have 2 questions:
1. How can I get the scripts to work correctly without receiving Internal Server Error messages? Am I installing something incorrectly?

2. I am installing the scripts into the root level cgi-bin folder that Plesk created when I set up the Domains. My Hosting company suggested I create a new cgi-bin in 'httpdocs' folder. Which folder should I be using?

Any help and advice would be very much appreciated.

Thanks.
 
You are using the correct directory. I too have had problems with getting scripts working in the cgi-bin directory. The only fix I have found is to enter "-w" after the shebang as such:

#!/usr/bin/perl -w

I still would like to know why this is necessary. I hope this helps.
 
Hi,

Thanks for your reply.

I tried what you suggested but that didn't work.

I have also been through everything in this post http://kb.swsoft.com/article_52_430_en.html but still no luck :mad:

I'm new to Plesk and I love the ease of use, but not being able to run CGI scripts is sooooo frustrating...
 
Hello,

PLease check the dos line endings as this is a general problem.

You can correct this by using this command:

dos2unix filename
then chmod and chown back to the right user.

If this does not work you can also check the suexec as that can be an issue too.

For further investigations you really need to check the logs and provide some error messages.
 
Hi,

Thanks for the info.

Looking through my error_log I have the following message:

Premature end of script headers: setup.cgi
 
This error is usually caused by editing the cgi file in a non ASCII mode and/or transfering the file in non-ASCII (binary) mode.

If the script file was opened, or edited in anyway by a program that does not know to preserve the strict ASCII formatting, then the file may have been messed up. For example, Web page editors will sometimes embed HTML tags in a CGI script file, thinking it is a Web Page. Don't open a CGI script file in something like MS Word, etc.

Perl CGI scripts should only be open with a strict ASCII text editor. and *only* be transferred in ASCII mode

Could this be causing your problem?
 
Hi,

Thanks for your reply.

I deleted the scripts and uploaded them again in ASCII mode, but I receive the same error message.

Plesk installs a test.cgi script within the cgi-bin for each Domain created, and this produces the same message (500 Internal Server Error).

Does this point to the Server not being set up correctly to run cgi scripts? Unfortunately my Hosting company are not interested in looking into this issue :(
 
Back
Top