wasi
This demo contains a WordPress website that can be run as a WCGI program by Wasmer.
To run this demo, you will need to install the Wasmer toolchain.
$ curl https://get.wasmer.io -sSfL | sh -s "v3.2.0-beta.2"
(version v3.2.0-beta.2
or more recent is required).
You can use wasmer run-unstable
to run the website locally.
$ wasmer run-unstable . --mapdir=/db:db
INFO run: wasmer_wasix::runners::wcgi::runner: Starting the server address=127.0.0.1:8000 command_name="php"
This codebase does the following hacks to Wordpress to have it full running:
exit;
or die;
to exit(0);
or die(0);
: they are equivalent, but they don't work without the arguments on the php-cgi
WASI counterpartecho " ";
before exit
as any header sent before an exit will be skipped if no body is being writtenReplaced wp-includes/class-wp-http.php
, wp-includes/class-wp-http-streams.php
, wp-includes/class-wp-http-curl.php
to return WP_Error
;
public function request( $url, $args = array() ) {
if (defined("IS_WASI") && IS_WASI) {
return new WP_Error( 'http_request_failed', __( "The HTTP request to $url failed." ) );
}
// ...
}
Replaced _maybe_update_plugins
in wp-includes/update.php
:
function _maybe_update_plugins() {
if (defined("IS_WASI") && IS_WASI) {
return [
"last_checked" => time() - 5,
];
}
// ...
}
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.