Direct Rust and PHP calls
There is no layer between Rust and PHP: no FastCGI, no sockets, no Goridge, no CGO, no serialization of any kind.
A PHP application server written in Rust.
The RoadRunner maintainers design and implement Rapira.
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 responsesRapira 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 modelPHP 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 workers are separate processes. They receive serialized requests from the server through pipes or sockets. Goridge defines the format of this data.
The server process contains the PHP interpreter. However, its Go host cannot call C code directly. CGO processes each call between the two languages.
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.