Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> CGI/Perl problems w/Apache on Starter-VPS, 500, please help!
kdunn
Posted: Jun 7 2005, 07:56 PM
Quote Post





Group: Members
Posts: 11
Member No.: 486
Joined: 7-June 05



With my Starter-VPS account, I cannot get anything but a 500 on my test perl script:
CODE
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
print "content-type: text/html

<html><body>hello!</body></html>
";

The site error_log shows only:
CODE
[Tue Jun 07 20:31:31 2005] [error] [client 69.60.110.98] Premature end of script headers: q1.cgi

The Apache error_log shows (for every attempted CGI access):
CODE
[Tue Jun 07 20:06:25 2005] [info] removed PID file /etc/httpd/run/httpd.pid (pid=17329)
[Tue Jun 07 20:06:25 2005] [notice] caught SIGTERM, shutting down
[Tue Jun 07 20:06:25 2005] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Tue Jun 07 20:06:25 2005] [notice] LDAP: SSL support unavailable
[Tue Jun 07 20:06:26 2005] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jun 07 20:06:26 2005] [notice] Digest: generating secret for digest authentication ...
[Tue Jun 07 20:06:26 2005] [notice] Digest: done
[Tue Jun 07 20:06:26 2005] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Tue Jun 07 20:06:26 2005] [notice] LDAP: SSL support unavailable
[Tue Jun 07 20:06:28 2005] [notice] Apache/2.0.51 (Fedora) configured -- resuming normal operations

I have already verified all the following:
  • script permissions = 755
  • script owner = group = webadmin
  • No CR's in script (I'm using emacs via SSH, so I would see them)
  • Syntax-checked the script and ran it from the cmd-line OK
The really frustrating thing is I cannot find any info on what exactly the problem is! You would think that would be in the log files...

Script file lives here: /home/kdunn/public_html/cgi-bin/auction/q1.cgi
ScriptAlias "/cgi2/" "/home/kdunn/public_html/cgi-bin/"
I access the script as: http://top-auction.my.speedingbits.com/cgi2/auction/q1.cgi

I get the same problem in any directory, for ANY CGI script (.html works OK) - I suspect this is an Apache config issue, not my forte.

Please help! sad.gif
TIA,

~Kristin
PMEmail Poster
Top
andy
Posted: Jun 8 2005, 12:28 AM
Quote Post





Group: Advantagecom Staff
Posts: 4,340
Member No.: 9
Joined: 12-July 02



CODE
#!/usr/bin/perl

use CGI;

print "Content-Type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<title> CGI/PERL TEST </title>\n";
print "</head>\n\n";
print "<body>\n\n";
print "Hello, world!<BR><BR>\n";
print "</body>\n";
print "</html>";


Check your script versus this script and you'll see several syntax differences. Note especially the \n\n after the content-type header line. That tells perl to print a new line character, which I believe is necessary for proper header functioning.

What I did to make it work is I logged into https://manage.speedingbits.com/cp and configured your web site settings. I setup the admin user for the site to be kdunn instead of webadmin since you were using the home directory of kdunn and not webadmin. I chowned the file to the proper ownership. I also edited your Apache config to point to the standard cgi-bin location ( /home/kdunn/top-auction.my.speedingbits.com/cgi-bin ).

Of course, using the control panel overwrote some of your custom Apache configs and setup the site to operate from the default location again, so you'll want to do one of two things:

1. Uninstall the control panels and manually edit Apache configs. If you run into problems with your Apache config, the best we'll be able to do is point you to working examples and the Apache documentation.

2. Use the control panels to setup your web site and copy your files to the locations setup by the system. It's far easier to copy your files to the correct location than it is to try to reconfigure Apache to use your files where they're already placed. The control panel takes care of the proper syntax as well as ownership and permissions issues on the directory structure used for the site.

At any rate, let us know if you need further assistance.


--------------------
Sincerely,
Andrew Kinney
CTO, Advantagecom Networks

Please do not private message me. My regular management duties preclude responding to every customer that sends me a support issue. Instead, post on the forum or contact tech support.
PMUsers Website
Top
kdunn
Posted: Jun 8 2005, 04:25 PM
Quote Post





Group: Members
Posts: 11
Member No.: 486
Joined: 7-June 05



Thank you for the help Andy. I think it's all working now smile.gif (quick - make a backup!)

I'm still not clear where the problem was (maybe conflicting uses of "cgi-bin" in Apache's config), but I'll take what I can get.

BTW, my test script did have the correct newlines; I am using literal newlines within a single string that spans a number of lines.

~Kristin
PMEmail Poster
Top
andy
Posted: Jun 8 2005, 04:47 PM
Quote Post





Group: Advantagecom Staff
Posts: 4,340
Member No.: 9
Joined: 12-July 02



QUOTE
I'm still not clear where the problem was (maybe conflicting uses of "cgi-bin" in Apache's config), but I'll take what I can get.


I'm sure it was something like that. Sometimes, for the sake of expediency, it is best to just make it work and not be too concerned about the details of why it didn't work previously. Of course, that reasoning doesn't apply in many cases, but it did here.

QUOTE
BTW, my test script did have the correct newlines; I am using literal newlines within a single string that spans a number of lines.


Fair enough. I'm used to being quite explicit when I program for the sake of clarity when I look at it a few years later. wink2.gif


--------------------
Sincerely,
Andrew Kinney
CTO, Advantagecom Networks

Please do not private message me. My regular management duties preclude responding to every customer that sends me a support issue. Instead, post on the forum or contact tech support.
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll