finds.dev← search

// the find

tenderlove/phuby

★ 268 · Ruby · updated May 2016

phuby wraps PHP in a loving embrace

Phuby embeds a PHP runtime inside a Ruby process via a C extension, letting you eval PHP code and exchange variables between the two runtimes. It's a joke project by Aaron Patterson (tenderlove) that actually works, or at least worked circa 2016. There is no real use case for this in production.

The C extension does genuine work — it links against PHP's embed SAPI and handles type conversions between PHP and Ruby values including arrays. Aaron Patterson wrote it, so the C is competent. It includes a Rack handler (`phuby/rails.rb`, `php_handler.rb`) meaning you could theoretically serve PHP files through a Rails app. The README's install instructions section just says 'No.' which is honest.

Dead since 2016 and requires building PHP from source with `--enable-embed`, which almost no distro ships. The extconf.rb hardcodes a mysql path and the README openly admits this won't be fixed. PHP's embed SAPI is not thread-safe, so this will explode under any concurrent Ruby server. The whole thing was built on OS X against whatever PHP version existed in 2013 — getting it to compile today would be an archaeology project.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →