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.
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.
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. :-)
It basically sets all the usual superglobals like $_SERVER, $_GET etc. Doesn't handle sessions just yet; I'm still working on that..
When I've tried to write long-running applications in PHP I always get memory leaks. How do you handle this in Kelpie?
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. :-)