Re: Simple perl question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the thoughts. responses are below.

On Jan 10, 2007, at 2:58 PM, Mark Feather wrote:

To be sure, at the command prompt type <whereis perl>......Is perl in the correct location?

yep -/usr/bin/perl Completely inaccessible from scripts running under the server.


What are the permissions of your cgi-bin directory and the script?

cgi-bin: 755 root:daemon, script: 555 root:daemon -same permissions as other cgi's (not perl) that are working properly


You say that your script has the .cgi extension but your error message is refering to a .pl extension!?

Well, I have tried both. The error message I pasted was from when I had changed the extention to .pl Doesn't seem to make a difference either way. .cgi is the original extension, however. My apologies for the confusion.


What is the name of your file? /cgi-bin/perl/routers2.pl or /cgi- bin/perl/routers2.cgi ?

yes :) Sorry- I have tried both, with the same results. routers2.cgi is the original name


Where is your cgi-bin?  Is it /var/www/cgi-bin or /var/cgi-bin

/var/www/gci-bin


Why do you have a sub-directory /cgi-bin/perl/ ?

That's what the documentation on the mod_perl website said, or more precisely the example they gave.


what are you typing into your browsers address bar? http:// DomainName/cgi-bin/FileName or http://DomainName/cgi-bin/perl/ FileName ?

http://DomainName/cgi-bin/perl/FileName



Sample code for a httpd.conf file for a cgi-bin:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI +Includes -indexes
Order allow,deny
Allow from all
</Directory>

<Location /cgi-bin>
AllowOverride None
Options +ExecCGI +Includes -indexes
SetHandler cgi-script
</Location>

That's great for CGI scripts (and is, in fact, what I have for the cgi-bin directory), but that's not what the mod_perl website says for executing perl scripts through mod_perl. The configuration block I showed in my original e-mail was straight from the mod_perl documentation.


Try testing a simple perl script, get this to work correctly then move on.

Create a script called test.cgi and place the following code within it:

[snip]

place this in your /cgi-bin/ directory change its permissions to 775 and try loading it into your browser using http://DomainName/ cgi-bin/test.cgi


That fails with the same "cannot find file or directory" error, as will ANY script that starts with #!/usr/bin/whatever - /usr/bin is NOT accessible to CGI scripts when Apache is running chrooted, as my install is. If a perl script (or any other script, for that mater) is going to work, it CANNOT have that line, or anything else that isn't a subdirectory of /var/www. So if the perl script needs to have direct access to the perl interpreter (and not just run through mod_perl), then it is impossible to run perl scripts with Apache chrooted.

Thanks again for the thoughts. I very much appreciate the responses.

-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service INC.
5245 Airport Industrial Rd
Fairbanks, AK 99709
-----------------------------------------------





----- Original Message ----- From: "Israel Brewster" <israel@xxxxxxxxxxxxxxxxxx>
To: <users@xxxxxxxxxxxxxxxx>
Sent: Wednesday, January 10, 2007 11:06 PM
Subject: Re:  Simple perl question


I installed mod_perl from the package that was distributed with OpenBSD 4.0. The install didn't give any errors, so I have to assume it installed properly. As far as I can tell, it didn't make any configuration changes. Just placing the script in my CGI directory (and removing the #!/usr/bin/perl line) gives "[error] (8)Exec format error: exec of /cgi-bin/perl/routers2.pl failed".
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service INC.
5245 Airport Industrial Rd
Fairbanks, AK 99709
-----------------------------------------------


On Jan 10, 2007, at 1:39 PM, Serge Dubrouski wrote:

For this configuration you need to have mod_perl installed on your
server. Why don't you simply put your script into your cgi-bin
directory?

On 1/10/07, Israel Brewster <israel@xxxxxxxxxxxxxxxxxx> wrote:
I don't know if what I am trying to do here is even possible (sane?)
but I thought I'd ask. I am running Apache 1.3.29 on an OpenBSD 4.0
system, with Apache chrooted to /var/www. I have a perl script CGI
(it has the .cgi extention, not .pl, but is actually a perl script)
that I need to run. Currently, the script is written to run using the system perl interpreter, with the first line of the script being #!/ usr/bin/perl This obviously doesn't work, since when it runs as a CGI
it is chrooted to /var/www, and can not see /usr/bin. Now I would
think that Apache should be able to run this script using the perl
module, which I have installed, but I can't seem to get it to work.
Could someone point me to something that tells me how to properly
enable/run perl scripts in Apache? I looked at mod_perl website, but
all it says is to add a code block like the following:

Alias /perl/ /home/httpd/perl/
   PerlModule Apache::Registry
   <Location /perl>
     SetHandler perl-script
     PerlHandler Apache::Registry
     Options ExecCGI
     allow from all
     PerlSendHeader On
   </Location>

which just gives me an 'Invalid command 'PerlModule' This would imply to me that mod_perl isn't being loaded, in spite of being installed,
but that leaves me needing to know how to load the perl module.
Adding a line like LoadModule mod_perl /usr/local/lib/mod_perl.so
(which is the correct path to the mod_perl.so file) just gives me a
"Can't locate API module structure `mod_perl' in file /usr/local/ lib/
mod_perl.so: Unable to resolve symbol" What am I missing here? How
can I get Apache to run perl scripts? Thanks for any assistance that
can be provided


-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service INC.
5245 Airport Industrial Rd
Fairbanks, AK 99709
-----------------------------------------------



------------------------------------------------------------------- -- The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



-------------------------------------------------------------------- - The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux