Wasm Labs

Running WordPress with WebAssembly using mod_wasm and Apache

By Rafael Fernández
At 2022 / 10 5 mins reading

WordPress is one of the most popular Content Management Systems. It typically runs on top of a LAMP stack (Linux + Apache + MySQL + PHP)

Thanks to the recently released mod_wasm module for Apache and the port of PHP to WASI you can now run WordPress inside a WebAssembly runtime.

WordPress and SQLite

Normally WordPress uses MySQL as the database backend. However, for the sake of simplicity, we want to use sqlite as the database backend, since the PHP version we will be using provides built-in support for sqlite. Fortunately, the WordPress project has very recently announced that they want to support SQLite officially, which is great news!

Trying it out

We put together a container that includes Apache, mod_wasm, PHP and WordPress all pre-configured and ready to run. You can try it out by executing the following command:

docker run -p8080:8080 projects.registry.vmware.com/wasmlabs/containers/php-mod-wasm@sha256:0f24de055a08501bb8bf866957b935bc7e75963160001d41ec71df8da5dcb18a

Now, point your browser to http://localhost:8080!

A browser showing Wordpress, which is running in server-side WebAssembly using Apache's mod_wasm and PHP compiled to wasm32-wasi

Missing bits

There are some parts of the stack that are not yet fully working, such as trying to visit /wp-admin. Performing the installation from scratch is also tricky at this time.

We decided to share it early to get feedback and are actively working on making this experience as close to the "native" one as possible. Please let us know what you think and stay tuned for new updates.

Do you want to stay up to date with WebAssembly and our projects?