You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Seldo <ne...@seldo.com> on 2003/02/06 01:09:05 UTC

Re[3]: Newbie advice required [some further info]

I mentioned that I don't think there's a way to practically supply
arbitrary data to Apache that looks like its coming from the
filesystem. The other way I thought of is this:

$r->uri() can map one URI to another. This means that a request to
        www.mydomain.com/app1/site/page.php
could be remapped by my module to call app1.exe "/site/page.php" (i.e.
using the remainder of the path as a parameter to determine what data
to supply. This works, but it means extension-based handlers like PHP
probably won't be activated -- how can I get around that, short of
manually coding support for every requested file type?

Also, the following code used as a PerlTransHandler sends the server
into what looks like an endless loop:

----
package Seldo::MaskURI;
use strict;
use warnings;
use Apache::RequestRec ();
use Apache::Const -compile => qw(DECLINED);
  
  sub handler {
      my $r = shift;
      $r->uri("/bob.php");

      return Apache::DECLINED;
  }
1;
----

The code is supposed to perform the (nonsensical) task of returning
"bob.php" no matter what URL the server is given. If ".php" is changed
to ".html" it works, but as I say, having it as .php throws it for
six. Anybody know why? It's possible there's something really obvious
wrong -- like I said, I barely know perl, far less mod_perl.

Seldo.
____________________________________________
  Seldo Voss: www.seldo.com
  ICQ #1172379 or me@seldo.com
--------------------------------------------
My friend drowned in a bowl of muesli. He was pulled in by a strong currant.


Re[2]: Newbie advice required [some further info]

Posted by Seldo <ne...@seldo.com>.
On 06 February 2003, Stas Bekman wrote:
SB> Have you configured your server to run .php files by php?

>From httpd.conf:     AddType application/x-httpd-php .php
(which is a yes as far as I'm concerned, but taking no chances...)

SB> Does a request to /bob.php works fine if requested directly (when
SB> you don't have your PerlTransHandler installed?

Yep, it works fine.

SB> Does it work for other handlers? e.g.:
$r->>uri("/perl/bob.pl");
SB> assuming that you have /perl configured to run ModPerl::Registry?

Hmm, that was illuminating -- that works fine too! And PHP is indeed a
filter in 2.0, as you say (unlike perl). So the problem is either
PHP-specific, or a problem with filters... gah. I'm going to bed now,
but at least I have a new line of attack to try in the morning.

Seldo.
____________________________________________
  Seldo Voss: www.seldo.com
  ICQ #1172379 or me@seldo.com
--------------------------------------------
Bart's Blackboard: "I will not strut around like I own the place."


Re: Newbie advice required [some further info]

Posted by Stas Bekman <st...@stason.org>.
Seldo wrote:
> I mentioned that I don't think there's a way to practically supply
> arbitrary data to Apache that looks like its coming from the
> filesystem. The other way I thought of is this:
> 
> $r->uri() can map one URI to another. This means that a request to
>         www.mydomain.com/app1/site/page.php
> could be remapped by my module to call app1.exe "/site/page.php" (i.e.
> using the remainder of the path as a parameter to determine what data
> to supply. This works, but it means extension-based handlers like PHP
> probably won't be activated -- how can I get around that, short of
> manually coding support for every requested file type?

Have you configured your server to run .php files by php?

> Also, the following code used as a PerlTransHandler sends the server
> into what looks like an endless loop:
> 
> ----
> package Seldo::MaskURI;
> use strict;
> use warnings;
> use Apache::RequestRec ();
> use Apache::Const -compile => qw(DECLINED);
>   
>   sub handler {
>       my $r = shift;
>       $r->uri("/bob.php");
> 
>       return Apache::DECLINED;
>   }
> 1;
> ----
> 
> The code is supposed to perform the (nonsensical) task of returning
> "bob.php" no matter what URL the server is given. If ".php" is changed
> to ".html" it works, but as I say, having it as .php throws it for
> six. Anybody know why? It's possible there's something really obvious
> wrong -- like I said, I barely know perl, far less mod_perl.

Does it work for other handlers? e.g.:

$r->uri("/perl/bob.pl");

assuming that you have /perl configured to run ModPerl::Registry?

Does a request to /bob.php works fine if requested directly (when you don't 
have your PerlTransHandler installed?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com