|
Home > Archive > Apache Server configuration support > August 2006 > Getting cgi working with .pl file extentions
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Getting cgi working with .pl file extentions
|
|
| splodge 2006-08-28, 1:48 pm |
| I have just taken over the admin of a small Apache 2.0.55 server at work
running on Debian (unstable). The last admin had turned cgi off (no idea
why, something to do with management being concerned about security). We
now need to turn this back on. I think I have just about figured it out,
the only problem is that PERL scripts only work if they have a .cgi
extention. Any file with a .pl extention is sent to the browser as a
download. I have tried using 'AddHandler cgi-script .pl' in the
apache2.conf file but no change (I even removed the .cgi bit from the
AddHandler but this didn't make any difference). Any idea what else I
can do to get this working?
I know the scripts are fine because if i rename 'test.pl' to 'test.cgi'
it runs as expected.
I don't mind .cgi working but I really need .pl to work as well.
Many thanks,
| |
| Davide Bianchi 2006-08-28, 1:48 pm |
| On 2006-08-28, splodge <splodge@blurryfox.com> wrote:
> Any idea what else I can do to get this working?
Usually having
ScriptAlias /cgi-bin/ "/where/is/your/cgi-bin/"
<Directory "/where/is/your/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
Will enable the scripts in /where/is/your/cgi-bin to run, no matter
what's the extension, from what you said it seems to me that you are
not using this way, but you have a specific 'handler' for every kind
of CGI script you want to run, no matter where you have them.
> I know the scripts are fine because if i rename 'test.pl' to 'test.cgi'
> it runs as expected.
Then I can only thinks that something prevent you to execute .pl files,
check your error_log file to see if there are any errors reported, if
you add the 'AddHandler' directive for CGI and then run
apachectl configtest
what does he says?
Davide
--
A fool and his money are soon using Windows.
| |
| splodge 2006-08-28, 1:48 pm |
| Davide Bianchi wrote:
> On 2006-08-28, splodge <splodge@blurryfox.com> wrote:
>
> Usually having
>
> ScriptAlias /cgi-bin/ "/where/is/your/cgi-bin/"
> <Directory "/where/is/your/cgi-bin">
> AllowOverride None
> Options None
> Order allow,deny
> Allow from all
> </Directory>
>
> Will enable the scripts in /where/is/your/cgi-bin to run, no matter
> what's the extension, from what you said it seems to me that you are
> not using this way, but you have a specific 'handler' for every kind
> of CGI script you want to run, no matter where you have them.
>
>
> Then I can only thinks that something prevent you to execute .pl files,
> check your error_log file to see if there are any errors reported, if
> you add the 'AddHandler' directive for CGI and then run
> apachectl configtest
> what does he says?
>
> Davide
>
David,
Many thanks for your quick responce. I have run the syntax check as
suggested and all in fine. I have changed my httpd.conf to reflect what
you put above. This working fine but nothing has changed. What is weird
is that if I comment out the ScriptAlias (plus following lines as above)
a file with .pl extention is still offered for download but a file with
..cgi extention is shown in the browser as text (ie you see the PERL code
in the browser). Looks like there is something hidden somewhere that is
telling Apache .pl files are for download; this must be happening before
it tries to run it as a cgi script. Any ideas?
Many thanks,
| |
| Davide Bianchi 2006-08-28, 1:48 pm |
| On 2006-08-28, splodge <splodge@blurryfox.com> wrote:
> in the browser). Looks like there is something hidden somewhere that is
> telling Apache .pl files are for download; this must be happening before
> it tries to run it as a cgi script. Any ideas?
You could have some "include" in your main httpd.conf that loads other
configuration files, so you have other directives that you don't see in
the main httpd.conf file, or you could have some .htaccess file in your
www tree that overrides the directives in your httpd.conf.
Those are the only things I can think of.
Davide
--
Eh? Linux is luserproof? What kind of "proper" set up is that,
ripping out all removable media devices and ethernet, freezing the
hard drive spindle, encasing it in concrete and dropping it off a pier?
-- Greg Andrews on alt.sysadmin.recovery
| |
| splodge 2006-08-29, 1:50 am |
| Davide Bianchi wrote:
> On 2006-08-28, splodge <splodge@blurryfox.com> wrote:
>
> You could have some "include" in your main httpd.conf that loads other
> configuration files, so you have other directives that you don't see in
> the main httpd.conf file, or you could have some .htaccess file in your
> www tree that overrides the directives in your httpd.conf.
>
> Those are the only things I can think of.
>
> Davide
>
Davide,
Once again many thanks for the quick reply. There are a couple of
..htaccess files, but they are only connected with password protecting
some directories. There are a number of 'includes', which I need to pull
through. I ran another quick test with a file called 'test.p' and this
also works fine. So there is a specific problem with files with a .pl
extention. Anyone know how to force Apache 2.0.55 to treat this file
type(or any other file type for that matter) in a particular way and
ignore the instructions in apache.conf / httpd.conf?
| |
| Mark Taylor 2006-08-29, 1:50 am |
| splodge <splodge@blurryfox.com> wrote in news:44f328eb$0$2661$ed2619ec@ptn-
nntp-reader02.plus.net:
> I have just taken over the admin of a small Apache 2.0.55 server at work
> running on Debian (unstable). The last admin had turned cgi off (no idea
> why, something to do with management being concerned about security). We
> now need to turn this back on. I think I have just about figured it out,
> the only problem is that PERL scripts only work if they have a .cgi
> extention. Any file with a .pl extention is sent to the browser as a
> download. I have tried using 'AddHandler cgi-script .pl' in the
> apache2.conf file but no change (I even removed the .cgi bit from the
> AddHandler but this didn't make any difference). Any idea what else I
> can do to get this working?
>
> I know the scripts are fine because if i rename 'test.pl' to 'test.cgi'
> it runs as expected.
>
> I don't mind .cgi working but I really need .pl to work as well.
>
> Many thanks,
Look for:
AddHandler cgi-script .pl
in your httpd.conf file.
----== Posted via webservertalk.com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.webservertalk.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
| |
| splodge 2006-08-29, 1:39 pm |
| Mark Taylor wrote:
> splodge <splodge@blurryfox.com> wrote in news:44f328eb$0$2661$ed2619ec@ptn-
> nntp-reader02.plus.net:
>
>
> Look for:
>
> AddHandler cgi-script .pl
>
>
> in your httpd.conf file.
>
>
>
> ----== Posted via webservertalk.com - Unlimited-Unrestricted-Secure Usenet News==----
> http://www.webservertalk.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Now appears to be resolved, not quite sure what fixed it. Many thanks
for the help.
|
|
|
|
|