• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

cgi-bin issues

E

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:
Code:
[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.
 
I've verified my scripts and the test script run on a non-Plesk FreeBSD/Apache server, so my problem is certainly Plesk-related.
 
Originally posted by ebiven
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:
Code:
[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.

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 ;))
 
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.
 
...Hope this helps.
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?
 
Originally posted by mikk
As per the post by jlschwab, it needs to be USERNAME:pSACLN - not PSASERV
DOH! That was it. Thanks guys.
 
Back
Top