Skip to content

Fix timeout starting sites with XDebug enabled using the packaged app#2410

Merged
wojtekn merged 2 commits intotrunkfrom
stu-1183-site-with-xdebug-enabled-doesnt-start-when-using-built
Jan 19, 2026
Merged

Fix timeout starting sites with XDebug enabled using the packaged app#2410
wojtekn merged 2 commits intotrunkfrom
stu-1183-site-with-xdebug-enabled-doesnt-start-when-using-built

Conversation

@epeicher
Copy link
Copy Markdown
Contributor

@epeicher epeicher commented Jan 16, 2026

Related issues

Related to STU-1183
Fix also suggested to the affected package WordPress/wordpress-playground#3125

Proposed Changes

  • Apply a patch to @php-wasm/node to fix the timeout when starting sites with XDebug enabled using the packaged app.

Testing Instructions

  1. Checkout this branch
  2. Run cd cli and npm install to install CLI dependencies
  3. Verify that the @php-wasm patch is applied, the following should be logged to the terminal:
Applying patches...
@php-wasm/node@3.0.22 ✔
  1. Run cd .., delete node_modules so the previous patch is applied.
  2. Run npm install to install main deps
  3. Run npm start
  4. Enable "Xdebug Support" beta feature in Settings → Beta Features
  5. Open Edit Site Details for any site
  6. Check "Enable Xdebug" checkbox and save
  7. Verify that the site can be stopped and started successfully
  8. Close Studio
  9. Run npm run make to package the application
  10. Once completed, open the out folder in the root of the repo, open your platform folder (e.g. Studio-darwin-arm64) and run Studio.app
  11. Check that the site with Xdebug enabled starts successfully
  12. Verify that the site can be stopped and started successfully

Test debugging in IDE

Copied from the original PR #2242

I used PhpStorm:

  1. Create a site
  2. Enable Xdebug and start the site
  3. Open the site in PhpStorm
  4. To stop breaking at the first line in PHPStorm, open Settings > PHP > Debug > Xdebug:
    • Disable > Force break at first line when no path mapping specified
    • Disable > Force break at first line when a script is outside the project
  5. Open WP Admin using link in Studio
  6. In PhpStorm, open the path mapping notification (or navigate to PHP|Servers) and configure mapping for your site's server:
  • Host: localhost:8884
  • Port: 80
  • File directory: /Users/USERNAME/Studio/SITEDIR
  • Absolute path on the server: /wordpress
  1. Add a breakpoint somewhere, e.g. in wp-config.php file
  2. Refresh WP Admin
  3. Confirm PhpStorm stops execution on the breakpoint

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@epeicher epeicher marked this pull request as draft January 16, 2026 15:48
@epeicher epeicher force-pushed the stu-1183-site-with-xdebug-enabled-doesnt-start-when-using-built branch from 806043f to 4f33a23 Compare January 16, 2026 16:04
@epeicher epeicher marked this pull request as ready for review January 16, 2026 16:37
@epeicher epeicher self-assigned this Jan 16, 2026
@epeicher epeicher requested a review from a team January 16, 2026 16:37
@wojtekn
Copy link
Copy Markdown
Contributor

wojtekn commented Jan 19, 2026

I'm testing it now.

@wojtekn
Copy link
Copy Markdown
Contributor

wojtekn commented Jan 19, 2026

It works as expected now.

@wojtekn wojtekn merged commit d33d9cd into trunk Jan 19, 2026
10 checks passed
@wojtekn wojtekn deleted the stu-1183-site-with-xdebug-enabled-doesnt-start-when-using-built branch January 19, 2026 10:06
return await Promise.resolve().then(() => (init_php_7_22(), php_7_2_exports2));
}
}
- throw new Error(`Unsupported PHP version ${version}`);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn’t remove this error that is thrown when the PHP version isn’t supported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted! I think that was removed by mistake. I'll add it back

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this patch as part of #2416

Copy link
Copy Markdown
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the test instructions and confirm the npm install applied the patch and I was able to start and stop a site with Xdebug:

Applying patches...
@php-wasm/node@3.0.22 ✔
pm2@6.0.14 ✔
ps-man@1.1.8 ✔

I just noticed that we are removing the error when the PHP version is not supported. throw new Error(`Unsupported PHP version ${version}`);. I suggest adding it back or explaining why that's necessary in .js and not in .cjs

@epeicher
Copy link
Copy Markdown
Contributor Author

I just noticed that we are removing the error when the PHP version is not supported. throw new Error(Unsupported PHP version ${version});. I suggest adding it back or explaining why that's necessary in .js and not in .cjs

That was a great catch @sejas! For some reason, my IDE is deleting that line when updating the file, but I have managed to add it back, as it is unrelated to the patch. The updated patch can be found in #2416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants