1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

cgi-bin issues

Discussion in 'Plesk for Linux - 8.x and Older' started by ebiven, Dec 9, 2005.

  1. ebiven

    ebiven Guest

    Plesk: 7.5.4
    FreeBSD 5.3

    When I try to execute a cgi script from a domain I'm getting the following in the apache error logs:
    [Fri Dec 09 16:18:34 2005] [error] [client x.x.x.x] Premature end of script headers: test-cgi
    I'm using the test-cgi script that came with Plesk so I would hope that it would work. I've tried monkeying with script permissions but that hasn't helped. I've verified that cgi is turned on for this account. I'm at a loss and there doesn't seem to be much info on this.
  2. ebiven

    ebiven Guest

    I've verified my scripts and the test script run on a non-Plesk FreeBSD/Apache server, so my problem is certainly Plesk-related.
  3. jlschwab

    jlschwab Guest

    This is more often than not caused by the first line of the perl cgi script having the windows (Micro$oft) control characters on it.
    Check the file's first line, do two things:

    1) Make sure the path to perl is appropriate.
    2) Make sure the first line isn't infected by DOS characters (^M).

    You can confirm if the file has or does not have the issue with the ^M characters, by running (on SSH terminal):

    % cat -ve thefile.cgi

    It will reveal all "hidden" characters.

    If this does not solve the problem, it could be that your cgi (perl) script has some special needs (perl library or module) that it's not finding.
    Although I must state usually that would cause an error with details about what's missing, so most likely doing the above will fix this issue.

    If this doesn't help any, please let me know, there's other steps we can take to fix this for sure.

    (I'm a pro perl web application developer my self, so I know a couple tricks ;))
  4. jlschwab

    jlschwab Guest

    One other note; you mention the standalone test-cgi script that comes with apache isn't working?

    You may need to check the ownership permissions for the cgi script as well, they *must* be the username of the user and the group set to "psacln" for cgi to execute at all.

    % chown someuser:psacln thefile.cgi

    Try this as well. This actually seems like it might be the problem for you.

    You can check the apache error logs (for the system) and there should be a suexec log, that would confirm if this was the problem.

    I wish apache would give a proper (invalid suexec options) error instead of this error when this occurs.

    Hope this helps.
  5. ebiven

    ebiven Guest

    Thanks for the response.

    I checked the permissions, they're all 755. They're owned by username:psaserv. The perl path is right. There are no bad eol characters. Any other ideas?
  6. mikk

    mikk Basic Pleskian

    Jan 29, 2005
    Likes Received:
    As per the post by jlschwab, it needs to be USERNAME:pSACLN - not PSASERV
  7. ebiven

    ebiven Guest

    DOH! That was it. Thanks guys.
  8. jlschwab

    jlschwab Guest

    Thanks for the credit bud ;)