Perl web form submit gets file download window rather than form execution and display

Posted on 2008-11-07
Medium Priority
Last Modified: 2012-05-05
First, this may not be a purely PERL question.
We recently updated our PERL software on our LAMP (Linux, Apache, MySQL, Perl) system.
Subsequently, a form which had been working great (and the code has not been changed)
Now, instead of executing, when a user clicks on the submit button, it pops up a window asking the user if they want to open the perl program with the PERL command line interpreter.

Any ideas what might need changing to resolve this?


Question by:gmanpert
  • 4
LVL 39

Accepted Solution

Adam314 earned 1200 total points
ID: 22907211
This usually means the webserver doesn't know it should be executing the file.
Did your apache httpd.conf change at all?
Do you have the ExecCGI option turned on for the directory the script is in?
Do you have the execute bit set for the webserver user?
LVL 48

Assisted Solution

Tintin earned 300 total points
ID: 22907352
Definitely not a Perl problem and absolutely an Apache configuration problem.

Check your Apache CGI configuration.

Author Comment

ID: 22909017
Here is where I'm at:

> Did your apache httpd.conf change at all?  

  Anything is possible but most likely no.

> Do you have the ExecCGI option turned on for the directory the script is in?

Here are my Apache Settings in my httpd.conf file:

 ScriptAlias /fperl "/www/htdocs/frms/fperl"
  <Directory "/www/htdocs/frms/fperl">
        AllowOverride None
        SetHandler cgi-script
        AddHandler cgi-script .PL .pl
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all

<Files "/www/htdocs/frms/fperl/simple.pl">
 AllowOverride None
 Options ExecCGI
 SetHandler cgi-script

Here is simple.pl script:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
foreach $key (sort keys(%ENV)) {
 print "$key = $ENV{$key}<p>";

Do you have the execute bit set for the webserver user?

 The simple.pl script is owned by wwwrun with group www and is readable and executable by User, Group, and World.

Trying to view http://mydomain/fperl/simple.pl

Still gets me a pop-up window with the text, "Opening simple.pl.  You have chosen to open simple.pl which is a PL file from http://mydomain  What should Firefox do with this file?"

I'm sure I am just missing something obvious, but I'm not sure what.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 22909029
Also, the simple.pl script works fine on another server... so you can definitely eliminate that as the source of the problem.

Basically, something is not turned on properly for CGI.  Just not sure what?


Author Comment

ID: 22909043
I should mention that mod_perl is loaded, mod_perl.so is where it should be. So that isn't the problem either.

Author Comment

ID: 22909634
Finally, resolved this.  Apparently, once we updated Apache and PERL on our servers one needs to use this configuration:

 ScriptAlias /fperl "/www/htdocs/frms/fperl"
  <Directory "/www/htdocs/frms/fperl">
        AllowOverride None
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        PerlOptions +ParseHeaders
        Options +ExecCGI
#        AddHandler perl-script .PL .pl
        Order allow,deny
        Allow from all

Thanks for the insights!


Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question