wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

Draft: XDebug support via dlopen

Open adamziel opened this issue 1 year ago • 1 comments

What is this PR doing?

Explores support for dynamic loading of PHP extensions.

Supersedes #673, consult that PR for the progress history and helpful comments.

Related to #314, #655, #89

Minimal dlopen example without PHP involved.

Testing instructions

Clone this branch to a directory with path /Users/cloudnik/www/Automattic/core/plugins/playground-2/wordpress-playground. It's not great, I know. I want to remove the explicit path dependency soon.

Then, create a /usr/local/etc/php.ini file with the following contents:

allow_url_fopen=1
extension=/Users/cloudnik/www/Automattic/core/plugins/playground-2/wordpress-playground/packages/php-wasm/node/public/mbstring.so
zend_extension=/Users/cloudnik/www/Automattic/core/plugins/playground-2/wordpress-playground/.libs/xdebug.so
xdebug.mode=debug
sys_temp_dir=/tmp

Finally, run:

$ nx reset; PHP=8.2 nx start php-wasm-cli -z ./.libs/xdebug.so ./test.php

Here's what you should see:

CleanShot 2023-12-01 at 12 44 58@2x

Remaining work

  • [x] Reconcile this branch with trunk. This PR ships many stale files.
  • [x] Clean up the code
  • [ ] Make this work with any disk path, not just the one listed above
  • [ ] Make XDebug step debugger work

adamziel avatar Dec 01 '23 12:12 adamziel