store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Sat May 18, 2013 9:32 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 1 post ] 
Author Message
 Post subject: cgi-bin .pl madness -- please help!
Unread postPosted: Mon Jul 16, 2012 8:01 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1843
Back in April I had a problem with running Perl scripts in cgi-bin on sites migrated from Plesk 8.6 to a fresh 10.4.4 install. They were not running at all and giving strange errors in the logs.

At the time, I created a hello world test file called hw.pl for testing.

It turned out that the issue and solution was simple -- the ownership of the cgi-bin directory needed to be user.psaserv and not user.psacln (which is how the migrated sites ended up).

I'm sure I tested quite a bit at the time and everything seemed to be great once the ownership was correctly set.

The problem is that today I've found that no script with a .pl extension in cgi-bin seems to work on any domain. I just get an error 500 Internal Server Error on screen, a "Premature end of script HEADERS" in the error log for the domain (my emphasis on the "headers").

My original hw.pl test file just had a print "hello world\n"; in it. It works fine as a a perl script (e.g. perl /var/www/vhost/domain.tld/cgi-bin/hw.pl displays "hello world" at the command prompt).

I know that when you get header errors it means we need to do something a bit more specific in terms of generating the content of the page.

So I replaced the contents of hw.pl with:

Code:
#!/usr/bin/perl
print "content-type:text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<title>Hello World</title>\n";
print "</head>\n";
print "<body>\n";
print "<b>Hello World!</b><br>\n";
print "</body>\n";
print "</html>\n";



But it made no difference. Still getting the same errors.

However, if I rename the new hw.pl to hw.cgi it works fine. No error. Web page with Hello World in it gets displayed.

An indeed, .cgi files server-wide work fine too, and if I rename them .pl they stop working.

So, what's up with the .pl files??

It is very obvious to me that I'm missing something really simple, fundamental and stupid. But I can't figure it out specifically.

I can see that .pl files get handled in quite a spcific way via the http[stuff].include in /var/www/vhost/conf and I know that somewhere (although I can't find it) there's probably an add-handler for .cgi files in the apache config.

They are obviously being treated differently. Maybe they are supposed to be treated differently? But they worked in 8.6 so I kind of expect them to work the same way in 10.4.4.

Pointers, even if they are along the lines of "You moron...don't you know that...." would be really appreciated!!!!

Additional info below, in case it help.

Thanks,

Faris.


Snippet from /var/www/vhosts/domain.tld/conf/[blah]_httpd.include

Code:
<IfModule mod_perl.c>
    <Files ~ (\.pl$)>
        SetHandler perl-script
        PerlHandler ModPerl::Registry
        Options ExecCGI
        allow from all
        PerlSendHeader On
    </Files>
</IfModule>


mod_perl is loaded via /etc/httpd/conf.d/perl.conf

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 1 post ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group