Webrick serving php pages?

I carry many .php pages, but I mostly write in Ruby these days.

My question is if webrick could be used to serve php pages.

Right now I use apache, but I want to be flexible and become less
dependant on apache. (Actually, that apache sends the pages to the php
interpreter, is pretty much the only reason I use apache).

Is it possible to send .php pages to the php parser, and have webrick
serve the resulting html “string” to the “visitor”? (“Visitor” because
these pages arent really for everyone, its mostly a local faq for me
which i wrote in php some years ago)

On 7/29/06, Marc H. [email protected] wrote:

I carry many .php pages, but I mostly write in Ruby these days.

My question is if webrick could be used to serve php pages.

Right now I use apache, but I want to be flexible and become less
dependant on apache. (Actually, that apache sends the pages to the php
interpreter, is pretty much the only reason I use apache).

It should be possible to use command line php (php.exe on win)
together with WEBrick::CGIHandler:

http://microjet.ath.cx/webrickguide/html/CGIHandler.html

That way, you’ll call your php scripts as
…/cgi/php.cgi/tada.php?fsgsdfg
(or similar, I haven’t tried)

Additionally, you can write PHPHandler < CGIHandler, that will call
php for you, and add it to the FileHandler configuration
(:HandlerTable,
http://microjet.ath.cx/webrickguide/html/FileHandler_Configuration.html)

Anyway, I expect it to be pretty slow, as php will be started each
time anew. Try, and you’ll see. (It’d be nice if you’d post your
findings, as I haven’t done this and I’m curious)

HTH,
Jano

Mongrel’s plugin support will be available soon, and I’m going to take
a shot at getting a PHP interpreter working with that, but as for
right now, your best bet is to look up NanoWeb. It’s a mini webserver
written in PHP, much like Webrick is to Ruby. It seems to perform very
well. If nothing else, you can configure it on a different port and do
some form of proxying to that port for getting the PHP pages served.

M.T.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs