Skip to content

Env: Add ability to specify xdebug.idekey for sake of debugging with PhpStorm/IntelliJ #41171

@westonruter

Description

@westonruter

What problem does this address?

I'm attempting to configure wp-env with Xdebug for PhpStorm/IntelliJ. As I understand, this requires an IDE key for PhpStorm to make the connection with the Debugger. For example, when I have created a server in PhpStorm called amp:

image

I can then run PHPUnit for my plugin with the following command and Xdebug will stop execution at any IDE-specified breakpoints:

wp-env run tests-wordpress 'env PHP_IDE_CONFIG=serverName=amp WORDPRESS_TABLE_PREFIX=wptests_ WP_TESTS_DIR=/var/www/wordpress-develop/tests/phpunit WP_PHPUNIT__TESTS_CONFIG=/var/www/html/phpunit-wp-config.php /var/www/html/wp-content/plugins/amp/vendor/bin/phpunit -c /var/www/html/wp-content/plugins/amp/phpunit.xml.dist

Note the PHP_IDE_CONFIG=serverName=amp environment variable being defined. So that works for the tests environment. However, I'm not having luck with the development environment. I think this is because the xdebug.idekey is undefined in the development instance. The only mention of this configuration I found in the project is #20636 (comment) but it was hardcoded to VSCODE and it didn't end up getting merged.

For context, see ampproject/amp-wp#6802 for attempting to standardize the AMP plugin development environment to use wp-env.

What is your proposed solution?

There could be a way to specify the xdebug.idekey in the .wp-env file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions