4 ms·
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 Apac
by tlrobinson 17y ago
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.
- dhotson 17y agoActually, 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 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 http://github.com/dhotson/kelpie/blob/master/demoapp.php Anyway, it's turning out to be a pretty fun little project. :-)
- tlrobinson 17y agoCool, I might write up a little library to provide the same interface to standard PHP CGI/Apache.
- dhotson 17y agoThis is what I've got so far: http://gist.github.com/339915 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..
- joshd 17y agoThat'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?
- dhotson 17y agoThanks 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. :-)