Joël Wurtz from JoliCode recounts how he built rphp, an experimental PHP virtual machine written in Rust, with large language models acting as an accelerator rather than an author. A first prototype was generated in a single day from the model's own knowledge. It could already run a fair range of PHP programs, but it was extremely slow and, crucially, implemented a stack VM while PHP is a register VM — a mismatch that can change value destruction order and error timing, on which existing libraries may depend.
Deliberately, the goal was not to clone the Zend Engine. Wurtz criticizes rewrites like Bun's for leaning on unsafe blocks, which in his view defeats the purpose of choosing Rust. Instead, the project aimed to understand why PHP works the way it does and to design a VM around Rust's philosophy: ownership, no global mutable state, minimal unsafe code. Reading Zend Engine sources with AI as a discussion partner revealed that some optimizations reflect older CPU behavior, while in other cases PHP had found the best solution years ago.
Two architectural ideas stand out. The VM is a self-contained object that can be instantiated multiple times per thread, easing testing and embedding. And a fork model lets a preloaded, paused VM be cloned with copy-on-write semantics per request: boot a Symfony kernel, cache expensive data, call rphp_request_pause(), and each request starts from that warm state while remaining isolated — sitting between classic per-request PHP and FrankenPHP's worker mode.
Current status: about 80% of basic compatibility tests pass. Pure PHP execution is 5 to 15 times slower than Zend's engine, but fork mode runs around 30 times faster than the VM's own classic mode — enough to beat PHP with FrankenPHP in classic mode on the Symfony Demo application, since application state is not rebuilt per request.
The project took about one month, using a Claude Max 20x plan (around 200€) with Opus 4.8, Sonnet 4.6 and occasionally Fable; Wurtz felt any of the three models would have produced similar results given constant steering. His conclusion: AI rarely gets things right first try, sometimes produces sloppy or wrong code that must be verified, and is no substitute for understanding — Rust's strict, deterministic constraints make it an especially good fit for AI-assisted work because errors surface automatically. The code is on GitHub at jolicode/rphp.
Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Waiting for your click …
·