Skip to content
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

Draft: XDebug support via dlopen #831

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft

Draft: XDebug support via dlopen #831

wants to merge 1 commit into from

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 1, 2023

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

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

@adamziel adamziel changed the title Start a fresh branch Draft: Support dynamic loading of PHP extensions via dlopen Dec 1, 2023
@adamziel
Copy link
Collaborator Author

This PR is now much simpler and xdebug functions work! However, connecting to a step debugger doesn't work yet. It seems like xdebug isn't even trying to open a remote socket here:

https://github.com/xdebug/xdebug/blob/49afefb7d9d313300369775b110c2ca2f2410b71/src/debugger/com.c#L246-L257

Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).

@adamziel adamziel changed the title Draft: Support dynamic loading of PHP extensions via dlopen Draft: XDebug support via dlopen Dec 21, 2023
@adamziel adamziel mentioned this pull request Dec 21, 2023
@adamziel adamziel force-pushed the trunk branch 2 times, most recently from 680cd19 to 2e376d2 Compare October 4, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant