News for hackers. Stuff that matters.
Re:PHP Fat Free Framework aka F3 by tlrobinson on Monday March 22, 2010 @04:20AM (#1209765)
Also, PHP really needs something like Plack/PSGI/Rack so that you don't have to manually reconfigure the web server for every library you want to use.

The Apache configuration mentioned in this article is pretty generic.

PHP has a standard HTTP interface, unlike the other languages before WSGI/Rack/JSGI/PSGI came around. Of course, PHP's interface isn't function-based, so you don't have the advantages of stackable middleware.

A spec closer to the *SGI's would indeed be nice.

Re:PHP Fat Free Framework aka F3 by dhotson on Monday March 22, 2010 @05:02AM (#1209817)
Actually, it's funny you should mention that. I wrote a little web server in PHP that's basically a port of Ruby's Rack:

http://github.com/dhotson/kelpie

It actually works pretty well, no apache required! It's pretty fast too.. all the init stuff you normally have to do every single request can be done once on server startup.

I also wrote a little sinatra style framework to go on top of it: http://github.com/dhotson/kelpie/blob/master/demoapp.php

Anyway, it's turning out to be a pretty fun little project. :-)

Re:PHP Fat Free Framework aka F3 by joshd on Monday March 22, 2010 @06:06AM (#1209903)
That's quite cool. That's some of the cleanest PHP I've seen.

When I've tried to write long-running applications in PHP I always get memory leaks. How do you handle this in Kelpie?

Re:PHP Fat Free Framework aka F3 by dhotson on Monday March 22, 2010 @06:18AM (#1209922)
Thanks Josh! :-D

Yeah, it's probably going to have memory leak issues. It's pretty much inevitable unfortunately. I've thought about having the server monitor the memory usage and periodically respawn processes. I believe apache uses a similar technique.

I'm open to ideas on this issue though. :-)

Re:PHP Fat Free Framework aka F3 by tlrobinson on Monday March 22, 2010 @05:28AM (#1209844)
Cool, I might write up a little library to provide the same interface to standard PHP CGI/Apache.
Re:PHP Fat Free Framework aka F3 by dhotson on Monday March 22, 2010 @05:44AM (#1209862)
This is what I've got so far: http://gist.github.com/339915

It basically sets all the usual superglobals like $_SERVER, $_GET etc. Doesn't handle sessions just yet; I'm still working on that..