Command Palette

Search for a command to run...

php package icon
shira/php
Public
wasmer run shira/php

PHP 8.5 for Wasmer

The PHP 8.5 command line runtime, compiled for WASIX (WASI preview 1 plus the POSIX extensions PHP needs) and packaged for the Wasmer runtime.

The registry only ships PHP 8.3 today; this package provides the 8.5 series so applications, CI jobs and Wasmer Edge deployments can use the features and security fixes of the newer branch.

Usage

# REPL-less one liners
wasmer run l844268235l/php -- -r 'echo PHP_VERSION, PHP_EOL;'

# run a script from the host directory
wasmer run l844268235l/php --volume .:/app -- -f /app/index.php

# built-in web server
wasmer run l844268235l/php --net --volume .:/app -- -t /app -S localhost:8080

# as a dependency of your own package
[dependencies]
"l844268235l/php" = "8.5.7"

[[command]]
name = "web"
module = "l844268235l/php:php"
runner = "wasi"

[command.annotations.wasi]
main-args = ["-t", "/app", "-S", "localhost:8080"]

What is inside

PathDescription
/modules/phpphp.wasm, the PHP 8.5 CLI compiled for wasm32-wasi/WASIX
/etc/sslCA bundle used by openssl and stream wrappers
/icuICU data used by the intl extension

Compiled extensions include bcmath, curl, exif, gd, iconv, igbinary, imagick, intl, mbstring, mysqli, opcache, openssl, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, soap, sodium, tidy and zip.

Custom configuration

PHP reads PHPRC; mount your own configuration and point PHP at it:

[fs]
"/config" = "config"

[[command]]
name = "php"
module = "l844268235l/php:php"
runner = "wasi"

[command.annotations.wasi]
env = ["PHPRC=/config/"]

License

PHP is distributed under the PHP License v3.01.

PHP 8.5 CLI runtime powered by WASIX. Runs PHP scripts, the built-in web server and Composer on the Wasmer runtime.


Github