![wcgi-wordpress-demo package icon](/_next/image?url=https%3A%2F%2Fcdn.wasmer.io%2FCACHE%2Fimages%2Ficon%2Fpackage%2F3a4024b9-19a9-494a-83e2-f769ec7ed643_default_icon%2Fef8aa5d36ade67673462404c6dc6fa3c.png&w=96&q=75)
wasi
WCGI WordPress Demo
This demo contains a WordPress website that can be run as a WCGI program by Wasmer.
Getting Started
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"
Hacks / Adaptations
This codebase does the following hacks to Wordpress to have it full running:
- Replace
exit;
ordie;
toexit(0);
ordie(0);
: they are equivalent, but they don't work without the arguments on thephp-cgi
WASI counterpart - Call
fwrite(STDOUT, '');
beforeexit
as any header sent before an exit will be skipped if no body is being written
Replaced 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() ) {
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() {
return [
"last_checked" => 1680680646,
];
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
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.