You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nicholas Aaron Philbrook <ap...@gmail.com> on 2006/01/09 20:51:16 UTC
MP2 Problem including local file
I recently put together a Gentoo server with apache and mod_perl. I'm
trying to run a perl script that has a require statement for a local
file, i.e.
require "database_util.pl"
where database_util.pl is another perl file in the same directory.
These scripts were running fine on another guy's server, but now I get
a 500 Internal Server Error when I try to access them via web, and the
apache error log says this:
[Mon Jan 09 13:50:51 2006] [error] Can't locate database_util.pl in
@INC (@INC contains: /home/httpd/perl /etc/perl
/usr/lib/perl5/site_perl/5.8.6/i686-linux
/usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.6/i686-linux
/usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.6/i686-linux /usr/lib/perl5/5.8.6
/usr/local/lib/site_perl . /usr/lib/apache2) at
/var/www/localhost/htdocs/latest/login.pl line 3.\n
It's funny because the current directory (.) is in the list of places
it looked, supposedly.
Also, interestingly the script will run fine from the command prompt
and duly chunk out the HTML that is supposed to show up on the web
page. The permissions are set appropriately, so that shouldn't be an
issue.
I am a perl newbie so please forgive me if I don't know what I'm
doing. I did a fair amount of searching and couldn't find a problem
similary to this one.
Thanks,
Nick
Re: MP2 Problem including local file
Posted by Tyler MacDonald <ty...@ActiveState.com>.
Nicholas Aaron Philbrook <ap...@gmail.com> wrote:
> I recently put together a Gentoo server with apache and mod_perl. I'm
> trying to run a perl script that has a require statement for a local
> file, i.e.
>
> require "database_util.pl"
>
> where database_util.pl is another perl file in the same directory.
> These scripts were running fine on another guy's server, but now I get
> a 500 Internal Server Error when I try to access them via web, and the
> apache error log says this:
When apache is running "." is the directory of your ServerRoot...
i'm not sure, but it looks like you are putting "database_util.pl" into your
DocumentRoot instead.
You could do something like;
use Apache2::RequestUtil ();
require $r->document_root . "/database_util.pl";
Cheers,
Tyler
Re: MP2 Problem including local file
Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2006-01-09 at 14:51 -0500, Nicholas Aaron Philbrook wrote:
> where database_util.pl is another perl file in the same directory.
> These scripts were running fine on another guy's server, but now I get
> a 500 Internal Server Error when I try to access them via web, and the
> apache error log says this:
>
> [Mon Jan 09 13:50:51 2006] [error] Can't locate database_util.pl in
> @INC
[...]
> It's funny because the current directory (.) is in the list of places
> it looked, supposedly.
The current directory is probably not what you think it is. If you're
using Registry, you may want RegistryPrefork. See this:
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Registry___C_Apache__PerlRun__and_Friends
- Perrin
Re: MP2 Problem including local file
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Nicholas Aaron Philbrook wrote:
> I recently put together a Gentoo server with apache and mod_perl. I'm
> trying to run a perl script that has a require statement for a local
> file, i.e.
>
> require "database_util.pl"
> Also, interestingly the script will run fine from the command prompt
> and duly chunk out the HTML that is supposed to show up on the web
> page. The permissions are set appropriately, so that shouldn't be an
> issue.
ModPerl::Registry does not chdir into your scripts directory.
See here:
http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html#Description
use either
ModPerl::PerlRunPrefork or
ModPerl::RegistryPrefork
--
------------------------------------------------------------------------
"Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without."
"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."
"I wanna hold ya till I die ... I wanna hold ya till the fear in me
subsides."
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F