Internal server error
I have an intresting problem, I have a test server running windows 2k, Activestate perl and apache 2. I have loaded the perl module mod_perl.so as well as told it to use C:/Perl/bin/perlxx.dll. In the httpd.conf I have commented out the script alias and add ExecCGI to the options, then added AddHandler cgi-script .cgi .pl to the configuration. Now when I try to run any perl script or cgi script I get an internal server error 500. With some vauge stuff in the error log that dosn't seem to be pertant at all. Ceratinaly not a cause for an internal error. Its not like the world would end if it couldn't find favico.ico. The perl script run a commandline or atleast parse. SO Im out of Ideas on waht to do. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Internal server error
Thanks for your response. However at the moment what I needed was perl to work on my webserver for testing purpose only on a global level. I found a way to enable perl using an apache directive and bypassed mod_perl altogether. So for the time being everything is fine. Thanks for you response though, its more then whatI got in the few irc channels I visited. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: The mod_perl protocol handler sample code have some problem!
Thanks! But the problem is still exist. - Original Message - From: "Randy Kobes" <[EMAIL PROTECTED]> To: "薛共和" <[EMAIL PROTECTED]> Cc: Sent: Thursday, July 21, 2005 12:47 PM Subject: Re: The mod_perl protocol handler sample code have some problem! On Thu, 21 Jul 2005, [big5] [EMAIL PROTECTED] wrote: > The sample code have some problem. When i telnet then > CommandServer in win32 everything is ok. But if i close > then console window(terminal) immediate, the apache is > hang. CPU use 100% resource. > > I try to use > $c->aborted() > OR > ($@ == APR::Const::ECONNABORTED ) > to check the connect but it can not detect the client is disconnect. [ ... ] I'm not sure if this will help, but you might try the use of APR::Status::is_ECONNABORTED(), as discussed at http://perl.apache.org/docs/2.0/api/APR/Status.html#C_is_ECONNABORTED_ to check if $@ corresponds to APR_STATUS_IS_ECONNABORTED, due to variants in the error conditions. -- best regards, randy kobes
is apache using modperl?
Hi. I've got the following script, which I picked up off the apache mod_perl pages, running. /~~~ #!/usr/bin/perl # Script: vegetables1.pl use CGI::Pretty ':standard'; print header, start_html('Vegetables'), h1('Eat Your Vegetables'), ol( li('peas'), li('peppers'), li('red'), li('green') ), hr, end_html; \___ How can I be sure that is being run by mod_perl and not by perl? Thanks. Kind regards. Luke. -- ._.. .| .| |.|/.|_ . .|__.|_|.|\.|_ . :61 421 276 282:
Re: is apache using modperl?
Hi. 26Sep2005 @ 09:40 Geoffrey Young thusly spake > > > Alexander Charbonnet wrote: > > Rename your Perl binary and see if it still works. :-) > > egads, no. > > >>How can I be sure that is being run by mod_perl and not by perl? > > http://perl.apache.org/docs/1.0/guide/install.html#How_can_I_tell_whether_mod_perl_is_running_ httpd -l doesn't show mod_perl. As I understand it: httpd -l only shows the statically linked modules. I obviously use mod_perl as a DSO. --- I have renamed my perl binary. My scripts work from apache. If I run them from the command line they don't. Is it safe to assume that mod_perl is working? > > --Geoff -- ._.. .| .| |.|/.|_ . .|__.|_|.|\.|_ . :61 421 276 282:
The Last-Modified header issue!
The apache v2.055 (mod_perl v2.02) will modify the Last-Modified's value automatically. If the OS time is "Sun, 18 Dec 2005 14:25:01 GMT" . And print out the Last-Modified header whith print "Last-Modified: Sun, 18 Dec 2005 14:28:01 GMT\n"; The apache will modify the value with "Sun, 18 Dec 2005 14:25:01 GMT" automatically. And the browser will receive the error result. How to override the Last-Modified's value using perl? httpd.conf= Alias /Test/ /usr/local/Test/cgi-bin/SetHandler perl-scriptPerlResponseHandler ModPerl::RegistryPerlSendHeader OnOptions +ExecCGI
what is difference with static and DSO mod_perl ?
How to setup httpd.conf ? when i using static (non-DSO) mod_perl. DSO mod_perl httpd.conf === LoadModule perl_module modules/mod_perl.so PerlRequire "/usr/local/perlmods/startfile.pl" Will i need recomplie apache when i modify my (perl)code , when using non-DSO mod_perl?
Need use modules in my code?
===http.conf=== LoadModule perl_module modules/mod_perl.soPerlRequire "/usr/local/perlmods/startfile.pl" ===startfile.pl=== use Compress::Zlib; The two type of code will work.But what is the proper code? #!/usr/bin/perl use Compress::Zlib; . print Compress::Zlib::memGzip($htmlstr); or #!/usr/bin/perl ... print Compress::Zlib::memGzip($htmlstr);
-M in modperl
opendir( DIR, "/path" ); my @dots = grep(/recovery/,sort { -M $a <=> -M $b } readdir(DIR)); closedir(DIR); Can not work in mod_perl?? How to solve it??
Re: -M in modperl
The result is not sort by file's mtime! But if i run the code in cgi or shell. It is sort by file's mtime. - Original Message - From: "LUKE" <[EMAIL PROTECTED]> To: Sent: Friday, January 13, 2006 12:58 AM Subject: -M in modperl > opendir( DIR, "/path" ); > my @dots = grep(/recovery/,sort { -M $a <=> -M $b } readdir(DIR)); > closedir(DIR); > > Can not work in mod_perl?? How to solve it?? >
Re: -M in modperl
linux apache 2.55 mod_perl v2.02 The file will list,but it is not sort by file's mtime in mod_perl! - Original Message - From: "LUKE" <[EMAIL PROTECTED]> To: Sent: Friday, January 13, 2006 1:06 AM Subject: Re: -M in modperl > The result is not sort by file's mtime! > But if i run the code in cgi or shell. It is sort by file's mtime. > > - Original Message - > From: "LUKE" <[EMAIL PROTECTED]> > To: > Sent: Friday, January 13, 2006 12:58 AM > Subject: -M in modperl > > > > opendir( DIR, "/path" ); > > my @dots = grep(/recovery/,sort { -M $a <=> -M $b } readdir(DIR)); > > closedir(DIR); > > > > Can not work in mod_perl?? How to solve it?? > >
Re: -M in modperl
sorry apache2.0.55 - Original Message - From: "LUKE" <[EMAIL PROTECTED]> To: Sent: Friday, January 13, 2006 1:17 AM Subject: Re: -M in modperl > linux apache 2.55 mod_perl v2.02 > > The file will list,but it is not sort by file's mtime in mod_perl! > > > - Original Message - > From: "LUKE" <[EMAIL PROTECTED]> > To: > Sent: Friday, January 13, 2006 1:06 AM > Subject: Re: -M in modperl > > > > The result is not sort by file's mtime! > > But if i run the code in cgi or shell. It is sort by file's mtime. > > > > - Original Message - > > From: "LUKE" <[EMAIL PROTECTED]> > > To: > > Sent: Friday, January 13, 2006 12:58 AM > > Subject: -M in modperl > > > > > > > opendir( DIR, "/path" ); > > > my @dots = grep(/recovery/,sort { -M $a <=> -M $b } readdir(DIR)); > > > closedir(DIR); > > > > > > Can not work in mod_perl?? How to solve it?? > > >
File handle in mod_perl
I have some problem about file handle in mod_perlV2.02 + apache v2.055. I got some strange result today.And i check the program find that i forgot to close(filehande). But this case to bring about some guestion! Will the code influence each other? When muti-user visit the same recourse at the same time? One clint at A and another in B. Q1.How to avoid this situation?? Need i lock file when i reading file?? Q2.what is difference between FLOCK_SH and FLOCK_EX ? #!/usr/bin/perl sub main{ print Header(); #print http header my var1=''; open(H,"/usr/local/my_setup"); while (){ $ var1.=$_; #<===A } close(H); my $var2; open(H,"/usr/local/my_page"); while (){ $ var2.=$_;#<===B } close(H); $var2=~s/SomeText/$var1/igs; print $var2; return; } main(); 1;
How to overide the Date header??
Apache will response Date info, But server and client have different clock and the cache(Expire Header) will become invalid. If i can get local pc datetime from _javascript_. and i can modify DATE header then the program will solve. But the Date header seem can not by modified. Why ?
Tesing Protocol Handlers got strange result!
Then code is from http://perl.apache.org/docs/2.0/user/handlers/protocols.html Command Server. When i start to test. It will not response Welcome Message until i type enter. Why? The FTP Server or SMTP Server will response Welcome Message first. If i want to implement those protocol using Apache2's Protocol Handlers. It will fail. PS. You can connect telnet se2.program.com.tw 25 to testing the program. PS. linux(Red Hat) + apache2.0.55 + mod_perlv2.02 + perl 5.8.7 package TestPH; use strict; use warnings FATAL => 'all'; use Apache2::Connection (); use Apache2::RequestUtil (); use Apache2::HookRun (); use Apache2::Access (); use APR::Socket (); use Apache2::Const -compile => qw(OK DONE DECLINED); my @cmds = qw(motd date who quit); my %commands = map { $_, \&{$_} } @cmds; sub handler { my $c = shift; my $socket = $c->client_socket; if ((my $rc = login($c)) != Apache2::Const::OK) { $socket->send("Access Denied\n"); return $rc; } $socket->send("Welcome to " . __PACKAGE__ . "\nAvailable commands: @cmds\n"); while (1) { my $cmd; next unless $cmd = getline($socket); if (my $sub = $commands{$cmd}) { last unless $sub->($socket) == Apache2::Const::OK; } else { $socket->send("Commands: @cmds\n"); return Apache2::Const::OK; } } return Apache2::Const::OK; } sub login { my $c = shift; my $r = Apache2::RequestRec->new($c); $r->location_merge(__PACKAGE__); for my $method (qw(run_access_checker run_check_user_id run_auth_checker)) { my $rc = $r->$method(); if ($rc != Apache2::Const::OK and $rc != Apache2::Const::DECLINED) { return $rc; } last unless $r->some_auth_required; unless ($r->user) { my $socket = $c->client_socket; my $username = prompt($socket, "Login"); my $password = prompt($socket, "Password"); $r->set_basic_credentials($username, $password); } } return Apache2::Const::OK; } sub getline { my $socket = shift; my $line; $socket->recv($line, 1024); return unless $line; $line =~ s/[\r\n]*$//; return $line; } sub prompt { my($socket, $msg) = @_; $socket->send("$msg: "); getline($socket); } sub motd { my $socket = shift; open my $fh, '/etc/motd' or return; local $/; $socket->send(scalar <$fh>); close $fh; return Apache2::Const::OK; } sub date { my $socket = shift; $socket->send(scalar(localtime) . "\n"); return Apache2::Const::OK; } sub who { my $socket = shift; # make -T happy local $ENV{PATH} = "/bin:/usr/bin"; $socket->send(scalar `who`); return Apache2::Const::OK; } sub quit { Apache2::Const::DONE } 1; __END__
Re: Tesing Protocol Handlers got strange result!
I confirm the apache version. The apache v2.0.54 have this problem. But apache v2.0.55 + mod_perl v2.02(win32 or linux) have no this problem. - Original Message - From: LUKE To: modperl@perl.apache.org Sent: Saturday, February 18, 2006 2:25 PM Subject: Tesing Protocol Handlers got strange result! Then code is from http://perl.apache.org/docs/2.0/user/handlers/protocols.html Command Server. When i start to test. It will not response Welcome Message until i type enter. Why? The FTP Server or SMTP Server will response Welcome Message first. If i want to implement those protocol using Apache2's Protocol Handlers. It will fail. PS. You can connect telnet se2.program.com.tw 25 to testing the program. PS. linux(Red Hat) + apache2.0.55 + mod_perlv2.02 + perl 5.8.7 package TestPH; use strict; use warnings FATAL => 'all'; use Apache2::Connection (); use Apache2::RequestUtil (); use Apache2::HookRun (); use Apache2::Access (); use APR::Socket (); use Apache2::Const -compile => qw(OK DONE DECLINED); my @cmds = qw(motd date who quit); my %commands = map { $_, \&{$_} } @cmds; sub handler { my $c = shift; my $socket = $c->client_socket; if ((my $rc = login($c)) != Apache2::Const::OK) { $socket->send("Access Denied\n"); return $rc; } $socket->send("Welcome to " . __PACKAGE__ . "\nAvailable commands: @cmds\n"); while (1) { my $cmd; next unless $cmd = getline($socket); if (my $sub = $commands{$cmd}) { last unless $sub->($socket) == Apache2::Const::OK; } else { $socket->send("Commands: @cmds\n"); return Apache2::Const::OK; } } return Apache2::Const::OK; } sub login { my $c = shift; my $r = Apache2::RequestRec->new($c); $r->location_merge(__PACKAGE__); for my $method (qw(run_access_checker run_check_user_id run_auth_checker)) { my $rc = $r->$method(); if ($rc != Apache2::Const::OK and $rc != Apache2::Const::DECLINED) { return $rc; } last unless $r->some_auth_required; unless ($r->user) { my $socket = $c->client_socket; my $username = prompt($socket, "Login"); my $password = prompt($socket, "Password"); $r->set_basic_credentials($username, $password); } } return Apache2::Const::OK; } sub getline { my $socket = shift; my $line; $socket->recv($line, 1024); return unless $line; $line =~ s/[\r\n]*$//; return $line; } sub prompt { my($socket, $msg) = @_; $socket->send("$msg: "); getline($socket); } sub motd { my $socket = shift; open my $fh, '/etc/motd' or return; local $/; $socket->send(scalar <$fh>); close $fh; return Apache2::Const::OK; } sub date { my $socket = shift; $socket->send(scalar(localtime) . "\n"); return Apache2::Const::OK; } sub who { my $socket = shift; # make -T happy local $ENV{PATH} = "/bin:/usr/bin"; $socket->send(scalar `who`); return Apache2::Const::OK; } sub quit { Apache2::Const::DONE } 1; __END__
Another program about Protocol Handers!
I use the code to redir smtp. And test the connection from outlook. But i find that the . can not recv from socket($socket->recv($line, 1024)) . I use WPR PRO to sniffer the packet , the outlook send out . . = package SMTP; use strict; use Apache2::Connection ( );use APR::Socket ( );use APR::Const -compile => qw(SO_NONBLOCK);use Apache2::Const -compile => 'OK';use HTTP::Date;use Socket;sub handler { my $c = shift; my $proto = getprotobyname('tcp'); my $host='aaa.bbb.com.tw'; my $port=25; my $iaddr = inet_aton($host); my $paddr = sockaddr_in( $port, $iaddr ); socket( SOCK, PF_INET, SOCK_STREAM, $proto ); connect( SOCK, $paddr ) ; select (SOCK); $|=1; select(STDOUT); my $welcomemsg=; my $socket = $c->client_socket; $socket-> opt_set(APR::Const::SO_NONBLOCK, 0); $socket->send($welcomemsg, length $welcomemsg); my $lines; my $cmd; my $line; my $i=0; while( $socket->recv($line, 1024)){ open(hh,">>/tmp/smtp.log"); print hh $i.$line; print hh "--($i)-\n"; close(hh); $i++; $lines .= $line; if ( $lines !~ /\n$/ ) { next; } binmode(SOCK); syswrite (SOCK ,$lines); my $response; binmode(SOCK); my $bs = sysread(SOCK, $response, 1024); $socket->send($response, length $response); $lines=''; } return Apache2::Const::OK;} 1;
How to avoid memory leak?
My system have seem memory leak problem. The MEM_USR raise . But how to debug?? Is the Apache::Leak for mod_perl v1.x module? PS:apache Apache/2.0.54 + MOD_PERL 2 no database <> Compress::Zlib;Crypt::RC5;Digest::MD4 'md4_hex';Data::Dumper;Encode::TW;Fcntl qw(:DEFAULT :flock);File::Copy;HTTP::Date;LWP;Net::LDAP;POSIX 'ceil';Socket;
strange problem,please help
Then mod_perl still run the old program after i modify the code. Even restart apache or OS . I still got the old result! Why? I must run fsck ?? The problem is filesystem Error? I often modify the code,but have no this problem before. How to trace the problem? = os:linux apache v2.2.3 mod_perl v2.02
Re: mod_perl using IPC::ShareLite
may be the linux ramdisk is another good choice. you can use memory like normal filesystem. - Original Message - From: "Frank Wiles" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Wednesday, September 27, 2006 9:45 PM Subject: Re: mod_perl using IPC::ShareLite > On Wed, 27 Sep 2006 13:13:51 +0100 > "Ben Wilder" <[EMAIL PROTECTED]> wrote: > > > My research so far has led me to believe that IPC::ShareLite could be > > used by the cron job script to set a few (very small) variables into > > a portion of shared memory, that a separate mod_perl application > > could poll. Mod_perl would not need to modify these variables, only > > read them. > > > > Would using a library such as IPC::ShareLite be considered a fudge > > for this type of action, is there some sort of global apache variable > > section that I can modify with one application and read out from > > another? > > > > Any thoughts appreciated! > >Using one of the IPC modules is definitely a reasonable choice >based on what you're trying to do. But I wanted to throw out >some other options as some people find IPC hard to work with. > >1. BerkeleyDB or sqlite. I realize you said you'd like to avoid a >database, but sometimes this means avoid installing a big >RDMS like PostgreSQL, MySQL, etc. > >2. memcached and Cache::Memcached could store your data in >a memory cache for you. > >3. Use can also use a simple config file with something like > Config::General. Your crons can update this data onto disk > and your mod_perl apps can simply read it in as a config file, > maybe using a short 5 minute cache to reduce disk reads. > >4. You could also use Storable to drop an object full of your > small variables from your cron and have your mod_perl app > read them in on each request ( or a short cache in pnotes or > something ). > >The last two may sound slow due to the disk reads, but it really >shouldn't cause a performance problem in all but the most >demanding environments. > > - >Frank Wiles <[EMAIL PROTECTED]> >http://www.wiles.org > - >
How to get virtualhost info in mod_perl?
The http://rd-program.blogspot.com and http://se-program.blogspot.com have the same ip address (72.14.207.191).How can i know the browser connect to apache server(in mod_perl) via which hostname?
The PerlProcessConnectionHandler on mod_perl 2.0.2 + apache v2.2.3
mod_perl 2.0.2 + apache v2.2.3 from http://www.devside.net/server/webdeveloper httpd.conf ThreadsPerChild 1920 I have a project must upload files to win2003 server. So i do the job by implement Protocol (Connection) Handlers in mod_perl. But the server will very busy when > 5 connections connect to apache at the same time. Maybe one connection upload big file (100M) . But in general the files is < 5M. The server have 4 cpu and Ram is 4G.But sometime the new connection will hang a little time (sometime can not accept new connections) .The cpu is not up to 100% and memory usage is still low.I have some problem want to know. 1. How the mpm_winnt work? It use one thread to keep the one request?Or it do many tasks by generate many thread on one connection? 2.Which one is more effective between Socket-based or Bucket Brigades-based Protocol? 3.The win32 task-manage show that the apache have 2 process.But sometime it have >2 process. Why? The apache use thread not process? 4.Have the Apache v2 mpm_prefork on win32? We testing the same code on linux.The performance is very very good than it on win2003 especially it have muti-connections on httpd. 5.Tuning the win2003 register will erase the upload file time. [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters] "DefaultReceiveWindow"=dword:00019000 "DefaultSendWindow"=dword:00019000 Need i up the DefaultReceiveWindow value(>102400) to import the performance ?
mod_perl-specific Compiler Options
What situation we need to modify the mod_perl's IO buffer size? http://perl.apache.org/docs/2.0/user/install/install.html#_DMP_IOBUFSIZE mod_perl-specific Compiler Options Change the default mod_perl's 8K IO buffer size, e.g. to 16K: MP_CCOPTS=-DMP_IOBUFSIZE=16384
Build static mod_perl and apachev2.2.3 fail
What is difference between apache v2.0.59 and v2.2.3? I can build static mod_perl and apache v2.2.3. Have anyone build static mod_perl and apache v2.0.59 successfully? -- Makefile.PL PREFIX=/usr/local/Portal/perlmods LIB=/usr/local/Portal/perlmods \ MP_USE_STATIC=1 MP_AP_PREFIX="/usr/local/mpasp/httpd-2.2.3" \ MP_AP_CONFIGURE="--with-mpm=prefork --prefix=/usr/local/apache2 --with-ssl=/usr/local/ssl --enable-rewrite=yes --enable-static-logresolve=yes --enable-static-rotatelogs=yes --enable-static-support=yes --enable-proxy=no --enable-expires=yes" && make && make install - http://perl.apache.org/docs/2.0/user/install/install.html#Static_mod_perl % perl5.8.x Makefile.PL \ MP_USE_STATIC=1 \ MP_AP_PREFIX="$HOME/src/httpd-2.0.xx" \ MP_AP_CONFIGURE="--with-mpm=prefork" % make
radius authentication then basic
Hi. I have the following situation: (Modperl1, apache 1.3) I have a number of machines accessing the webserver. Currently I either have them all authenticate through radius or none at all. I have a web application that has it's own authentication mechanism. When I have the radius authentication directives in place in httpd.conf All authentication takes place through radius. When I remove those directives the authentication goes through the application. What I want is for certain hosts to authenticate through radius and others to authenticate through the application. How do I do this? -- Luke
(OT) LWP question
Hi. I have a question that is not specifically modperl related, but I'm hoping someone on thsi list can help. I am using LWP to download a series of html pages from a site. The pages also contain images. I'd like to download any related images used in the pages. Is there a perl module that can do this? Thanks. Kind regards. -- Luke
practical mod_perl
Hi all Anyone who has the (chm/pdf), please give me a copy. Thanks Good luck. Luke