Skip to content

Add PIE support for native extension #504

Open

Description

@nickchomey

I want to use the native extension with Static PHP, which is used to make static builds of frankenphp.

I had asked the team at Static PHP to consider adding the native parser extension to their static builds, but they felt it was a bit too niche to be appropriate. They also said that there would probably be problems due to the Rust toolchain

crazywhalecc/static-php-cli#1239

They said that it would be ideal if PIE support could be added to the native extension, such that you could just do this

sudo apt install -y php-devel pie-zts
sudo pie-zts install wordpress/extension_name
and you're done. PIE compiles from source, so it'll take a bit, but this seems to be a very small extension so only a few seconds.

Is this something that could be done?

I see one comment in the codebase related to PIE, but I dont know what to make of/do with it.

# Tell cargo/rustc to build with PIE-friendly relocations as well.

Activity

  1. JanJakes commented on Sep 7, 2026

    @JanJakes
    Member

    Thanks for the suggestion! We’ve added a new parser in #429 who's benchmarks show roughly 5× faster lexing and parsing than the current PHP implementation, though it isn’t integrated into the SQLite driver yet.

    Once that integration is complete, we’ll re-evaluate whether native extensions still provide enough benefit to justify maintaining them. We’ll revisit PIE support as part of that decision.

  2. nickchomey commented on Sep 7, 2026

    @nickchomey
    Author

    Ah cool, thanks for the update. Can you share a link to the issue/pr for the new parser integration? Id love to follow along. #432 is the pr for the integration

    Side question: can the new parser's logic be ported to the native extension? If so, that would be the ideal so as to minimize the extra latency per page request (I have some pages that do a lot of DB queries that can't always be put in object cache)

  3. JanJakes commented on Sep 9, 2026

    @JanJakes
    Member

    Side question: can the new parser's logic be ported to the native extension?

    Yes. I think it's reasonable to try it and evaluate the speedups, and based on the results, we can decide whether maintaining the extension is worth it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions