新的 PHP SAPI 在安全 Rust 中

1作者: jhavenz大约 1 个月前原帖
我最近发布了初始版本的 ripht-php-sapi RC。<p>这是一个安全的 Rust 绑定,用于 PHP 的嵌入式 SAPI。它允许你在 Rust 中执行 PHP 脚本,而无需接触不安全的代码。<p>GitHub: https://github.com/jhavenz/ripht-php-sapi<p>Crate: https://crates.io/crates/ripht-php-sapi<p>我计划构建一些基于 Rust 的高级 PHP 工具,但需要一个干净的起点。我也没有看到现有的 Rust SAPI 实现,因此大约三个月后,这个项目就诞生了。这段时间里有相当一部分是用于研究的。令人惊讶的是,外面关于这方面的教育材料是如此稀缺和陈旧。因此,能从 20 多年的经过实践检验的源代码中学习真是个好事!感谢 Nginx unit、php/php-fpm、Apache 和 Frankenphp。能够比较和对比不同的实现非常有帮助。如果有人对 PHP SAPI 内部和 Rust FFI 的内容感兴趣,可以查看这个链接了解更多信息: https://www.patreon.com/posts/gauging-php-sapi-146489023<p>我欢迎反馈。
查看原文
I recently published the initial ripht-php-sapi RC.<p>It’s safe Rust bindings for PHP&#x27;s embed SAPI. Lets you execute PHP scripts from Rust without touching unsafe code.<p>GitHub: https:&#x2F;&#x2F;github.com&#x2F;jhavenz&#x2F;ripht-php-sapi<p>Crate: https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;ripht-php-sapi<p>I&#x27;d plan to build some higher level Rust-based PHP tooling but need the proverbial clean slate. I also didn’t see any existing SAPI implementations for Rust, so ~3 months later, here it is. A good chunk of that was research. It’s surprising how scarce and archaic the educational material is out there. So, good thing there was 20+ years of battle-tested source code to learn from! Thank you to Nginx unit, php&#x2F;php-fpm, apache, and Frankenphp. Being able to compare and contrast implementations was extremely helpful. Also gauging interest in content about PHP SAPI internals and Rust FFI if anyone&#x27;s curious about that rabbit hole: https:&#x2F;&#x2F;www.patreon.com&#x2F;posts&#x2F;gauging-php-sapi-146489023<p>I’m open to feedback