Skip to content

reduce php binary to minimum - #7

Open
soyuka wants to merge 1 commit into
mainfrom
minimal-phpdoc-build
Open

reduce php binary to minimum#7
soyuka wants to merge 1 commit into
mainfrom
minimal-phpdoc-build

Conversation

@soyuka

@soyuka soyuka commented Oct 16, 2024

Copy link
Copy Markdown
Owner

Clone this branch, then run:

docker buildx bake
cp build/* ../phpdoc/web-php/js

Comment thread Dockerfile

FROM build_tool as php_src
ARG PHP_BRANCH=PHP-8.3.0
ARG PHP_BRANCH=PHP-8.4.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ARG PHP_BRANCH=PHP-8.4.0
ARG PHP_BRANCH=PHP-8.4

(It would be even better to use the latest tag).

@dunglas

dunglas commented Oct 16, 2024

Copy link
Copy Markdown

You could likely reduce the size more by compressing the final file using these tricks: https://rustwasm.github.io/book/reference/code-size.html

@soyuka

soyuka commented Oct 16, 2024

Copy link
Copy Markdown
Owner Author

actually everything is built-in emcc: https://emscripten.org/docs/optimizing/Optimizing-Code.html#how-to-optimize-code and I found -O2 to be the most optimized when it comes to building PHP. The thing we need to do is serve the .wasm gzipped.

Also emcc already uses wasm-opt.

@drupol

drupol commented Dec 10, 2024

Copy link
Copy Markdown

I'm interested to build this reproducibly with Nix!

@soyuka

soyuka commented Jan 17, 2025

Copy link
Copy Markdown
Owner Author

@drupol what's the problem with Nix it should work

derickr added a commit to derickr/php-wasm-builder that referenced this pull request Feb 6, 2025
This is based on soyuka/php-wasm#7

Support for mbstring and the XML extensions will be in the next commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants