-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI and networking support #119
Conversation
Is there a discussion of where these patches come from or why they are what they are? Is there a reason they have to be here vs. in a fork of the upstream projects? I saw patches to SSL, which you know, catches the eye. |
Here's some discussion started about the patches: Propose PRs for the projects that are now patched ad-hoc. |
As @eliot-akira mentioned, I'd love to merge these patches to the upstream projects. I will open Pull Requests for actively maintained projects like Emscripten. Unfortunately, PHP 5.6 and some friends are not getting new releases anymore. The OpenSSL patch you've mentioned is actually a PHP 5.6 patch to add OpenSSL 1.1.0 support. It's been proposed for upstream PHP 5.6 and rejected. AFAIK most webhosts who still support PHP 5.6 are maintaining their own fork to keep applying security patches. Here's the overview of all the patches:
|
Let's merge this one and keep iterating in subsequent PRs |
### Description Adds support for CLI SAPI and networking in node.js: ``` > npm run build > node ./build-cli/php-cli.js -r 'echo "Hello from PHP !";' Hello from PHP ! > node ./build-cli/php-cli.js -r 'echo substr(file_get_contents("https://wordpress.org"), 0, 16);' <!DOCTYPE html> > node ./build-cli/php-cli.js -r 'echo phpversion();' 8.2.0-dev > PHP=5.6 node ./build-cli/php-cli.js -r 'echo phpversion();' 5.6.40 ``` ### Highlights: * Networking is supported (including MySQL and HTTPS) * Switching PHP versions is supported. * [Most WordPress PHPUnit tests pass](WordPress/wordpress-playground#111). The failures are caused by missing extensions and a few misconfigured settings * PHP Interactive mode is supported but [the arrow keys don't work](WordPress/wordpress-playground#118) * `wp-cli` works ### In broad strokes: * CLI SAPI is compiled with libedit (readline replacement) and ncurses. * Network calls are asynchronous. Emscripten's Asyncify enables calling asynchronous code from synchronous code. TCP sockets are shimmed with a WebSocket connection to a built-in proxy server running on localhost. It supports data transfer, arbitrary connection targets, and setting a few TCP socket options. * PHP's OpenSSL uses the same CA certs as Node.js * PHP 5.6 is patched to work with OpenSSL 1.1.0 and many other small patches are introduced. For more details, see [patches overview](WordPress/wordpress-playground#119 (comment)), Dockerfile, and `phpwasm-emscripten-library.js` ### Future work: * PHP Interactive server isn't supported yet. Adding support is a matter of making the incoming connection polling non-blocking using Asyncify. * Use a more recent OpenSSL version * [Better support for CLI interactive mode](WordPress/wordpress-playground#118)
Description
Adds support for CLI SAPI and networking in node.js:
Highlights:
wp-cli
worksIn broad strokes:
phpwasm-emscripten-library.js
Future work: