A PHP application server written in Rust

Hi all,

for the purpose of learning Rust I've started working on an early-stage project called FerrumPHP, and I’d appreciate feedback on the architecture and some of the design decisions before it stabilizes further.

It's a PHP application server written in Rust. It embeds the Zend engine via ext-php-rs and serves HTTP requests through a custom SAPI implementation. It's meant to run behind a reverse-proxy rather than being a full-fledged web server.

Architecture in a few points:

  • Hyper is used for the HTTP server, with a Tower service and tokio's mpsc channels to stream requests/responses and bridge async Rust with sync PHP worker threads
  • One OS thread per PHP worker. Workers receive jobs via a crossbeam channel
  • Each job carries a tracing::Span across thread boundaries

Feedback is most welcome on the bridging of async Rust with long running threads, PHP SAPI callback ownership patterns, Streaming design (Tokio ↔ crossbeam ↔ Zend bridge) or any obvious pitfalls I might be missing.

Here's the repo: GitHub - hwawshy/ferrumphp: A PHP Application Server written in Rust · GitHub

Many thanks in advance.

I have a bad luck, I needed PHP support and I couldn't find any good Rust web server with PHP support, so spent 6 months to write own, but now we have some cool server written by you. Thank you very much, keep the tremendous work up.