-1

In order to solve another problem, I want to manually provide certain configuration options for the Run Debug configuration.

In PhpStorm, at

Settings > PHP > Debug > Settings

there is a flag for

Pass require configuration options through command line (still need to enable debug extension manually)

For troubleshooting purposes, I disabled that flag, yet I don't see where to add my custom configuration options instead.

How to add custom configuration options?

I want to provide custom values for the flags:

  • dxdebug.mode
  • dxdebug.client_port
  • dxdebug.client_hos

How to?

2
  • You can pass additional params to your PHP interpreter at PHP Interpreter screen (jetbrains.com/help/phpstorm/… -- see the "Configuration options" field on Step #5 screenshot). The -d option will be used for them. Params added there will take over what PhpStorm actually detects for Xdebug (as they will be added later in the command line). Commented Aug 28, 2024 at 12:04
  • NOTE: Since it's a PHP Interpreter options, they will be used in CLI environment only. Means: will not affect your Apache/nginx/etc web server but will be used for CLI commands, PHPUnit tests, PHP's built-in web server and similar -- any tools where PHP executable can be used directly by the IDE. Commented Aug 28, 2024 at 12:05

1 Answer 1

2

These config options are read through the php.ini within your WSL instance.

Add this in your relevant php.ini or 20-xdebug.ini, e.g.: /etc/php/8.3/cli/conf.d/20-xdebug.ini:

zend_extension=xdebug.so
xdebug.client_host=xdebug://gateway
xdebug.mode=debug
xdebug.client_port=9003

Addendum: I also had the use case to get xdebug working both on fpm and cli.

The default is to create an ini template in:

/etc/php/8.x/mods-available/xdebug.ini

This will symlink the template file in the respective cli and fpm subfolder via:

phpenmod -v 8.x xdebug

(Replace x with your relevant minor php version.)


Addendum 2:

I also wanted to be able to trigger an xdebug session on cli via

$ XDEBUG_TRIGGER=1 ./somePhpFile.php

For that I added:

xdebug.start_with_request=trigger

to the xdebug.ini file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.