Skip to content

Provide pre-built binary releases for Linux and Windows #5

Open

Description

@ardhie1032

I really like the idea and the project you're working on.

My suggestion is to provide binary releases (executables) for Linux or Windows users so they can easily try it out. Growth and adoption are usually much faster that way, sort of like the BunJS runtime (especially with a Windows binary release). Not every PHP developer uses or even likes Rust. People generally prefer things that are more practical and hassle-free.

Activity

  1. francescotinti commented on Nov 2, 2026

    @francescotinti
    Owner

    Thanks for the kind words and the suggestion — noted as an enhancement request, and here is where things stand so expectations are honest.

    Why there are no prebuilt binaries yet. phpr deliberately links the system C libraries that the PHP oracle itself links (libgd, libtidy, libxslt/libexslt, libxml2) so that generated bytes — images, XSLT output, tidy output — are identical to PHP's. That choice is what makes the byte-parity test suite meaningful, but it also means a binary is tied to the ABI of those libraries on the target machine: a static, "download and run" executable like Bun's would need a different (bundled) codec stack and would then diverge from PHP on exactly the outputs we test for. This is a design trade-off, not an oversight.

    Linux today. Building from source on Linux works: PR #3 (merged today, main 8d5f159) fixed the macOS-only link paths and the libxml2 ≥ 2.12 symbol rename. With a Rust toolchain (rust-toolchain.toml pins 1.98.1) and the -dev packages of libgd, libtidy, libxslt and libxml2 installed, cargo build --release -p php-cli produces phpr. If you try it and something breaks, please open an issue with the distro and library versions — that is the fastest way to get a Linux tarball eventually, because it tells us which library eras to target.

    Windows. Not supported and not planned for now: the runtime assumes a Unix process model (/dev/stdout, POSIX signals, Unix sockets, select() on fds) and the system-library linking above has no Windows counterpart. WSL2 with a Linux build is the realistic path.

    What could come first. A Linux x86_64/aarch64 tarball built on a mainstream distro (glibc + libxml2 2.9 era and ≥ 2.12 era), published per pinned release, once there is a CI machine for it; the project is still in a phase where the macOS pin is the only measured reference. I'll leave this issue open as the tracking item for that.

  2. added a commit that references this issue on Nov 2, 2026
  3. annmuor commented on Nov 2, 2026

    @annmuor
    Contributor

    It might be possible to build static phpr via musl (musl is a libc implementation that allows static linking), then we will have a cool static binary that works almost everywhere.

    For Windows we have Cygwin with MUSL that provides fake POSIX API (literally same libc functions, sockets etc). I've built many projects over cygwin with very little changes.

  4. ardhie1032 commented on Nov 2, 2026

    @ardhie1032
    Author

    That's an interesting approach!

    A statically linked binary using musl would definitely make distribution much easier, especially for Linux users. Having a portable executable that doesnt depend heavily on the host system's libraries would be a huge advantage.

    The Cygwin approach for Windows is also worth exploring, although I think native Windows binaries would still provide the best experience for most users.

    Ultimately, my main point is about accessibility and adoption. The easier it is for developers to download, run, and experiment with phpr, the more likely they are to give the project a chance.

    Not everyone wants to deal with Rust toolchains, system dependencies, or building from source just to try a PHP runtime.

    I'd love to see this project eventually offer prebuilt binaries for major platforms, regardless of the underlying implementation. I think that would be a great step toward wider adoption.

  5. annmuor commented on Nov 2, 2026

    @annmuor
    Contributor

    Actually I was able to build a static phpr with musl.

    It requires a bit of effort but it works.

    static-musl-phpr.zip

  6. francescotinti commented on Nov 2, 2026

    @francescotinti
    Owner

    Thank you all — this thread moved further in one afternoon than I expected, and I'm grateful for it.

    @ardhie1032 — thank you for opening this and for keeping the focus where it belongs: a PHP developer should be able to download phpr and run it without touching a Rust toolchain. I agree with that; my earlier answer was only meant to explain why the first binaries weren't there yet, not to argue against them.

    @annmuor — thank you for the musl suggestion and, even more, for actually doing it. I had a look at the attachment (inspected, not executed, as I would with any binary from outside): it is a genuine static-pie x86_64 ELF, musl, with libgd, libtidy, libxslt/libexslt and libxml2 linked in, built with rustc 1.98.1 — the same toolchain the repo pins. That settles the point I had considered open: linking the same C libraries as PHP does not preclude a self-contained binary, as long as the static archives come from the right library era. Good news, and I'm happy to be proved wrong here.

    Where I'd like to take it from here, if you're willing:

    1. The recipe is the thing worth merging, even more than the binary. Could you share how you built it — distro/toolchain, target (x86_64-unknown-linux-musl with crt-static, I assume), the extra -l libraries the static archives needed (png/jpeg/webp/freetype/lzma/z…) and any RUSTFLAGS or build-script tweaks? A PR with a docs/BUILD-STATIC.md and, if it helps, a PHPR_STATIC_LIBS=1 switch in the php-types build script would be very welcome and would carry your name. If a comment here is easier for you, I'll turn it into a PR myself and credit you in the commit.
    2. CI lane and release artifact. Once the recipe is written down, I'll add a workflow_dispatch lane (musl container on the x86_64 runner) that builds the static binary and runs the unit battery, and attach the artifact to the pinned releases. For transparency: the byte-parity gates against PHP 8.5.7 run locally on macOS, so the Linux static binary would at first be "builds and passes the unit tests", not "oracle-verified"; the release notes will say so until a Linux oracle gate exists. Meanwhile, for anyone building from source: build + the full unit battery already pass on ubuntu-latest in the repo's CI.
    3. Windows. Cygwin + musl is a more realistic path than I gave it credit for, given how little the runtime asks of the OS (/dev/stdout, poll(2), Unix sockets). I'm keeping it as a stretch item under this same issue. A native Windows build — which is what @ardhie1032 rightly asks for — needs someone with a Windows machine and stays out of my reach for now.

    I'll keep the issue open as the tracking item for the static Linux artifact. Thanks again, both of you.

  7. added a commit that references this issue on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions