[PHP-DEV] [emile@iris-advies.com: Re: [PHP-DEV] Adding URI Translation Handlers]

2001-06-22 Thread Stephen van Egmond

Back when the mailing lists were down, I started a discussion about
adding a feature to PHP to do URI translating.

The brief definition of URI translation is that you get to rewrite URIs
dynamically.  This is how you you would host, for instance, 10,000
florist home pages:

http://florists.ftd.com/rosebowlfloral/
and http://florists.ftd.com/fiveflower/

without having 10,000 directoriies under the server root.  In Apache,
these would be rewritten to a directory containing the style of page
the florist chose, with some extra apache notes to tell you which
florist page had been visited.

The question I wanted to raise was how to do this.  And although it
looks like initially a simple task, it generalizes to a few other
concepts which Apache + mod_perl has done wonders with.

This was the most recent post on the topic, and I wondered if there
were other thoughts out there?

Failing that, I will probably pursue the approach of building this into
the Apache SAPI and letting other web servers follow suit.


- Forwarded message from Emiliano [EMAIL PROTECTED] -

Date: Thu, 31 May 2001 09:34:00 +0200 (CEST)
From: Emiliano [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Adding URI Translation Handlers

Stephen van Egmond wrote:

 One thing which I am bumping into is the need to do URI rewriting, kind
 of like what mod_perl does.
 
 I would like to implement this myself in mod_php, and I'm looking for
 some advice on the implementation.  I considered the following:
 
 a) Allowing the automatically prepended file (see php's
 auto_prepend_file config option) to change $ENV['REQUEST_URI'] before
 the script is actually executed. This, intuitively, seems clean, but
 would probably happen too late in the request process (it will have
 already decided to call the error file).

Yep. This would be executed in the response phase, but apache itself
would have decided in the translation phase way before that not to
handle the request.

 b) adding a new config directive that... what?  defines a file to be
 read which is supposed to define a function? Is eval'ed?

The way I see it you have a couple of options:

- Use mod_perl, mod_python, mod_tcl(I think) to script a translation
  handler.
- Write a translation handler in C (we do this with Midgard)
- Extend mod_php4 to do what mod_perl et al do so you can write
  handlers in PHP. Conceptually, this is not too hard, but will
  definately be more work than the other two. You set up the zend
  engine just like the response phase handler does, set a few relevant
  variables before you start it (like $ENV['REQUEST_URI'] for example,
  kick off the script (either be just executing the code, or calling a
  function therein), then read the relevant variables after the script
  exits and act on them. You'll be doing this in C.

Emile


- End forwarded message -

-- 
   ,,,
  (. .)
+--ooO-(_)-Ooo- -  -- - - -  -
| The Annotated BeBook:  http://bang.dhs.org/be/bebook/

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] [emile@iris-advies.com: Re: [PHP-DEV] Adding URI Translation Handlers]

2001-06-22 Thread Brian Moon

Isn't this what mod_rewrite is for?

Also, what we do is have urls like:

http://dealnews.com/articles/23930.html

We use a force type on the feil articles to make it get parsed as PHP.  We
then read $PATH_INFO in which is /23930.html to set up our vars.

You could have:

http://florists.ftd.com/florists/rosebowlfloral/

Although it makes for a longer URL, it does not require all the files you
talked about and does not require any C.

Brian Moon
--
dealnews.com, Inc.
Makers of dealnews  dealmac
http://dealnews.com/ | http://dealmac.com/


- Original Message -
From: Stephen van Egmond [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 22, 2001 12:09 AM
Subject: [PHP-DEV] [[EMAIL PROTECTED]: Re: [PHP-DEV] Adding URI
Translation Handlers]


 Back when the mailing lists were down, I started a discussion about
 adding a feature to PHP to do URI translating.

 The brief definition of URI translation is that you get to rewrite URIs
 dynamically.  This is how you you would host, for instance, 10,000
 florist home pages:

 http://florists.ftd.com/rosebowlfloral/
 and http://florists.ftd.com/fiveflower/

 without having 10,000 directoriies under the server root.  In Apache,
 these would be rewritten to a directory containing the style of page
 the florist chose, with some extra apache notes to tell you which
 florist page had been visited.

 The question I wanted to raise was how to do this.  And although it
 looks like initially a simple task, it generalizes to a few other
 concepts which Apache + mod_perl has done wonders with.

 This was the most recent post on the topic, and I wondered if there
 were other thoughts out there?

 Failing that, I will probably pursue the approach of building this into
 the Apache SAPI and letting other web servers follow suit.


 - Forwarded message from Emiliano [EMAIL PROTECTED] -

 Date: Thu, 31 May 2001 09:34:00 +0200 (CEST)
 From: Emiliano [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DEV] Adding URI Translation Handlers

 Stephen van Egmond wrote:

  One thing which I am bumping into is the need to do URI rewriting, kind
  of like what mod_perl does.
 
  I would like to implement this myself in mod_php, and I'm looking for
  some advice on the implementation.  I considered the following:
 
  a) Allowing the automatically prepended file (see php's
  auto_prepend_file config option) to change $ENV['REQUEST_URI'] before
  the script is actually executed. This, intuitively, seems clean, but
  would probably happen too late in the request process (it will have
  already decided to call the error file).

 Yep. This would be executed in the response phase, but apache itself
 would have decided in the translation phase way before that not to
 handle the request.

  b) adding a new config directive that... what?  defines a file to be
  read which is supposed to define a function? Is eval'ed?

 The way I see it you have a couple of options:

 - Use mod_perl, mod_python, mod_tcl(I think) to script a translation
   handler.
 - Write a translation handler in C (we do this with Midgard)
 - Extend mod_php4 to do what mod_perl et al do so you can write
   handlers in PHP. Conceptually, this is not too hard, but will
   definately be more work than the other two. You set up the zend
   engine just like the response phase handler does, set a few relevant
   variables before you start it (like $ENV['REQUEST_URI'] for example,
   kick off the script (either be just executing the code, or calling a
   function therein), then read the relevant variables after the script
   exits and act on them. You'll be doing this in C.

 Emile


 - End forwarded message -

 --
,,,
   (. .)
 +--ooO-(_)-Ooo- -  -- - - -  -
 | The Annotated BeBook:  http://bang.dhs.org/be/bebook/

 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]