# WSGI-like SAPI for PHP ?

- Thread: https://externals.io/message/49611
- Original archive: https://news-web.php.net/php.internals/49611
- Started by FGM@GMail on 2010-09-13T12:24:54+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #49611 — FGM@GMail — 2010-09-13T12:24:54+00:00

URL: https://externals.io/message/49611#49611

Hello,

Having to do some work in Python recently, I had to dig into WSGI and found
that its model, much similar to what JSGI, PSGI, Rack do, seemed likely to
bring a potentially high performance improvement on my usual (Drupal)
environment. This also happened to match a remark done by Rasmus during his
presentation in late August at Drupalcon CPH, in which he advised us to
evolve Drupal towards a model with a long-term application process - PHP or
not, apparently not in his idea (C ?) - to avoid the massive amount of time
and effort currently spent on our per-page bootstrapping process, and return
PHP userland code to the more "templating" parts of the CMS.

However, after digging around on the list archives and elswhere, I could
find no trace of a discussion about an approach like this one. CGI/FCGI
sure, FPM sure, but nothing like WSGI. The closest approximation appears to
be the WPHP package, which does indeed embrace PHP within actual WSGI, but
does so at the cost of a fork/exec per hit, definitely the opposite of the
goal being looked for.

Has there ever been such a discussion, if only to dismiss the prospect as
incompatible with PHP/ZE ? Any pointers to more information would be
appreciated.

Frederic G. MARAND

---

## #49612 — gaochunhui@gmail.com — 2010-09-13T12:56:58+00:00

URL: https://externals.io/message/49611#49612 · In reply to: #49611

Support WSGI SAPI, WSGI more simple.

-----邮件原件-----
发件人: FGM at GMail [mailto:fgmarand@gmail.com] 
发送时间: 2010年9月13日 20:25
收件人: internals@lists.php.net
主题: [PHP-DEV] WSGI-like SAPI for PHP ?

Hello,

Having to do some work in Python recently, I had to dig into WSGI and found
that its model, much similar to what JSGI, PSGI, Rack do, seemed likely to
bring a potentially high performance improvement on my usual (Drupal)
environment. This also happened to match a remark done by Rasmus during his
presentation in late August at Drupalcon CPH, in which he advised us to
evolve Drupal towards a model with a long-term application process - PHP or
not, apparently not in his idea (C ?) - to avoid the massive amount of time
and effort currently spent on our per-page bootstrapping process, and return
PHP userland code to the more "templating" parts of the CMS.

However, after digging around on the list archives and elswhere, I could
find no trace of a discussion about an approach like this one. CGI/FCGI
sure, FPM sure, but nothing like WSGI. The closest approximation appears to
be the WPHP package, which does indeed embrace PHP within actual WSGI, but
does so at the cost of a fork/exec per hit, definitely the opposite of the
goal being looked for.

Has there ever been such a discussion, if only to dismiss the prospect as
incompatible with PHP/ZE ? Any pointers to more information would be
appreciated.

Frederic G. MARAND

---

## #49615 — Dennis Hotson — 2010-09-13T13:56:28+00:00

URL: https://externals.io/message/49611#49615 · In reply to: #49611

> Hello,
>
> Having to do some work in Python recently, I had to dig into WSGI and found
> that its model, much similar to what JSGI, PSGI, Rack do, seemed likely to
> bring a potentially high performance improvement on my usual (Drupal)
> environment. This also happened to match a remark done by Rasmus during his
> presentation in late August at Drupalcon CPH, in which he advised us to
> evolve Drupal towards a model with a long-term application process - PHP or
> not, apparently not in his idea (C ?) - to avoid the massive amount of time
> and effort currently spent on our per-page bootstrapping process, and
> return
> PHP userland code to the more "templating" parts of the CMS.
>
> However, after digging around on the list archives and elswhere, I could
> find no trace of a discussion about an approach like this one. CGI/FCGI
> sure, FPM sure, but nothing like WSGI. The closest approximation appears to
> be the WPHP package, which does indeed embrace PHP within actual WSGI, but
> does so at the cost of a fork/exec per hit, definitely the opposite of the
> goal being looked for.
>
> Has there ever been such a discussion, if only to dismiss the prospect as
> incompatible with PHP/ZE ? Any pointers to more information would be
> appreciated.
>

Have you seen this?
http://github.com/indeyets/appserver-in-php

I also had a crack at implementing a web server in PHP. It's inspired by
Ruby's Rack and even uses the mongrel HTTP parser:
http://github.com/dhotson/kelpie
.. mine is mostly just a toy and hasn't been thoroughly tested, but I did
manage to halve my app's average response time without even really trying.

The main advantage of the app server approach is that you can do your
framework init stuff once at server startup instead of every single request,
which can be a pretty huge saving.
The main problem is that PHP isn't very good at long running processes.

Also worth checking out: http://mongrel2.org

- Dennis Hotson

---

## #49617 — Rasmus Lerdorf — 2010-09-13T15:15:07+00:00

URL: https://externals.io/message/49611#49617 · In reply to: #49611

> Having to do some work in Python recently, I had to dig into WSGI and found
> that its model, much similar to what JSGI, PSGI, Rack do, seemed likely to
> bring a potentially high performance improvement on my usual (Drupal)
> environment. This also happened to match a remark done by Rasmus during his
> presentation in late August at Drupalcon CPH, in which he advised us to
> evolve Drupal towards a model with a long-term application process - PHP or
> not, apparently not in his idea (C ?) - to avoid the massive amount of time
> and effort currently spent on our per-page bootstrapping process, and return
> PHP userland code to the more "templating" parts of the CMS.

I think that was some creative listening on your part.  I talked about
moving the rendering engine to C, not about any sort of persistent
application process.

-Rasmus
