RE: Apache showing Perl code
Hi, This is because your perl handler is not active. How did you setup your apache for perl scripts under mod_perl ? I see you're using windows ? Are you sure mod_perl is working (check out Apache error log when it starts) ? Take a look at the docs for Apache::Registry or Apache::PerlRun. " I just installed Apache and mod_perl, but for some reason when I execute scripts through my Apache server it shows all of the Perl code: #!C:/Perl/bin/Perl.exe print "Content-type: text/html\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; } I got the path found on the first line from an example Perl script (printenv.pl) that came with the latest version of the Apache server. Could anybody give me a hand with a suggestion or two? " -- Miroslav Madzarevic, [EMAIL PROTECTED] Mod Perl Development - http://www.modperldev.com Telephone: +381 64 1193 501 ICQ: 15880893 Linux user #217444 DEBIAN jamph
Re: Apache showing Perl code
It seams to be your configuration problem on your apache. Make sure this on your httpd.conf: Options FollowSymLinks +ExecCGI AddHandler cgi-script cgi pl AllowOverride None Willy "Edwin D. Vinas" <[EMAIL PROTECTED]To: "B.J. Faught" <[EMAIL PROTECTED]>, .gov.ph> <[EMAIL PROTECTED]> cc: 03/06/2003 05:09 Subject: Re: Apache showing Perl code AM Hi, Usually, a perl script when not set to "chmod +x" or as executable file will just be treated as an ordinary text file. This may be the reason why you get the text file instead of executing the commands inside the file. Please make sure you: "chmod +x your_script.pl" Then try to execute first using the command line. If it doesn't work in the command line, it won't surely work in the web browser. best regards, --edwin - If Americans have atomic bombs & the Internet... Filipinos are very far behind to catch up in any field. -Edwin D. Viñas [EMAIL PROTECTED] http://www.geocities.com/edwin_vinas Science Research Specialist I PREGINET Project Advanced Science and Technology Institute UP Technopark Complex, CP Garcia Ave, Diliman, Quezon City Philippines - This communication is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient, please note that any review, retransmission, dissemination, copying or other use of, or taking of any action in reliance upon, this information by you or by persons or entities other than the intended recipient is prohibited. - Original Message - From: "B.J. Faught" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 06, 2003 5:40 PM Subject: Apache showing Perl code > I just installed Apache and mod_perl, but for some reason when I execute > scripts through my Apache server it shows all of the Perl code: > > #!C:/Perl/bin/Perl.exe > print "Content-type: text/html\n\n"; > > foreach $var (sort(keys(%ENV))) { > $val = $ENV{$var}; > $val =~ s|\n|\\n|g; > $val =~ s|"|\\"|g; > print "${var}=\"${val}\"\n"; > } > > I got the path found on the first line from an example Perl script > (printenv.pl) that came with the latest version of the Apache server. > > Could anybody give me a hand with a suggestion or two? > >
Re: Apache showing Perl code
Hello B. I just reread your question it is MP2. For ModPerl2 there is another answer in the FAQ: Apache::Registry, Apache::PerlRun and Friends Apache::Registry, Apache::PerlRun and other modules from the registry family now live in the ModPerl:: namespace to avoid collisions with the versions from 1.0. To run the Apache::Registry module from mod_perl 1.0 you have to load Apache::compat at the startup: file:startup.pl: use Apache2; # if you have 1.0 and 2.0 installed use Apache::compat (); use lib ...; # to find 1.0x Apache::Registry then in httpd.conf: Alias /perl /path/to/perl/scripts Options +ExecCGI SetHandler perl-script PerlResponseHandler Apache::Registry Notice that Apache::compat has to be loaded before CGI.pm if the latter module is used. META: complete META: document that for now ModPerl::Registry doesn't chdir() into the script's dir like Apache::Registry does, because chdir() affects the whole process under threads. Kind regards, Gerard ter Haar > > From the FAQ: > My CGI/Perl Code Gets Returned as Plain Text Instead of Being Executed by the > Webserver > > Check your configuration files and make sure that the ExecCGI is turned on in your > configurations. > > > SetHandler perl-script > PerlHandler Apache::Registry > Options ExecCGI > allow from all > PerlSendHeader On > > > Kind regards > > > I just installed Apache and mod_perl, but for some reason when I execute > > scripts through my Apache server it shows all of the Perl code: > > > > #!C:/Perl/bin/Perl.exe > > print "Content-type: text/html\n\n"; > > > > foreach $var (sort(keys(%ENV))) { > > $val = $ENV{$var}; > > $val =~ s|\n|\\n|g; > > $val =~ s|"|\\"|g; > > print "${var}=\"${val}\"\n"; > > } > > > > I got the path found on the first line from an example Perl script > > (printenv.pl) that came with the latest version of the Apache server. > > > > Could anybody give me a hand with a suggestion or two? > > > > > >
Re: Apache showing Perl code
Hello B. >From the FAQ: My CGI/Perl Code Gets Returned as Plain Text Instead of Being Executed by the Webserver Check your configuration files and make sure that the ExecCGI is turned on in your configurations. SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader On Kind regards > I just installed Apache and mod_perl, but for some reason when I execute > scripts through my Apache server it shows all of the Perl code: > > #!C:/Perl/bin/Perl.exe > print "Content-type: text/html\n\n"; > > foreach $var (sort(keys(%ENV))) { > $val = $ENV{$var}; > $val =~ s|\n|\\n|g; > $val =~ s|"|\\"|g; > print "${var}=\"${val}\"\n"; > } > > I got the path found on the first line from an example Perl script > (printenv.pl) that came with the latest version of the Apache server. > > Could anybody give me a hand with a suggestion or two? > >
Re: Apache showing Perl code
Hi, Usually, a perl script when not set to "chmod +x" or as executable file will just be treated as an ordinary text file. This may be the reason why you get the text file instead of executing the commands inside the file. Please make sure you: "chmod +x your_script.pl" Then try to execute first using the command line. If it doesn't work in the command line, it won't surely work in the web browser. best regards, --edwin - If Americans have atomic bombs & the Internet... Filipinos are very far behind to catch up in any field. -Edwin D. Viñas [EMAIL PROTECTED] http://www.geocities.com/edwin_vinas Science Research Specialist I PREGINET Project Advanced Science and Technology Institute UP Technopark Complex, CP Garcia Ave, Diliman, Quezon City Philippines - This communication is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient, please note that any review, retransmission, dissemination, copying or other use of, or taking of any action in reliance upon, this information by you or by persons or entities other than the intended recipient is prohibited. - Original Message - From: "B.J. Faught" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 06, 2003 5:40 PM Subject: Apache showing Perl code > I just installed Apache and mod_perl, but for some reason when I execute > scripts through my Apache server it shows all of the Perl code: > > #!C:/Perl/bin/Perl.exe > print "Content-type: text/html\n\n"; > > foreach $var (sort(keys(%ENV))) { > $val = $ENV{$var}; > $val =~ s|\n|\\n|g; > $val =~ s|"|\\"|g; > print "${var}=\"${val}\"\n"; > } > > I got the path found on the first line from an example Perl script > (printenv.pl) that came with the latest version of the Apache server. > > Could anybody give me a hand with a suggestion or two? > >
Apache showing Perl code
I just installed Apache and mod_perl, but for some reason when I execute scripts through my Apache server it shows all of the Perl code: #!C:/Perl/bin/Perl.exe print "Content-type: text/html\n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; } I got the path found on the first line from an example Perl script (printenv.pl) that came with the latest version of the Apache server. Could anybody give me a hand with a suggestion or two?