Skip to content

A PHP application server written in Rust.

The RoadRunner maintainers design and implement Rapira.

A built-in HTTP server that uses hyper

PHP does not include a production HTTP server. Its built-in server is a development tool. php-fpm requires a separate web server such as nginx.

Rapira includes an HTTP server that uses the Rust hyper library. Hyper reads each request and writes the response from Rapira.

HTTP requests and responses

Rust calls PHP directly

Rapira uses Rust, and PHP uses C. Rust calls C functions directly. Therefore, Rust can call a PHP function directly. Rapira embeds the interpreter in the server process. Direct bindings control interpreter initialization and request processing.

Rapira does not use FastCGI, Goridge, or CGO. It does not serialize requests or send them to another process. In Classic and Worker modes, Rapira fills the superglobals directly.

Process model

PHP runs in separate processes. The web server sends FastCGI records through a socket. The PHP process parses each request and returns a serialized response.

  • php-fpm
  • nginx
  • Angie

PHP workers are separate processes. They receive serialized requests from the server through pipes or sockets. Goridge defines the format of this data.

  • RoadRunner

The server process contains the PHP interpreter. However, its Go host cannot call C code directly. CGO processes each call between the two languages.

  • FrankenPHP

An ABI defines how compiled languages call each other. Rust supports the C ABI directly. Rust and C use the same machine instructions for these calls.

  • Rapira