1

I'm trying PhpStorm with xdebug, but when I try to validate the configuration, shows me a warning: remote debug is not enabled, as shown the image bellow. In the same way phpinfo() shows xdebug.remote_enable as Off, and of course, debug doesn't work.

php.ini xdebug configuation:

[xdebug] zend_extension = /usr/lib/php/20180731/xdebug.so xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.profiler_enable=1 xdebug.profiler_output_dir="/tmp/xdebug/" xdebug.remote_host = "localhost" xdebug.remote_port=9000 xdebug.idekey="PHPSTORM" 

enter image description here

3
  • I think there is an issue in remote port, you mentioned 9001 and php storm is looking for 9000, can you update and check it again? Commented Jun 29, 2020 at 16:06
  • 2
    You must be editing the wrogn php.ini file.. or have xdebug settings defined in a separate .ini file (that is parsed in addition to master file). Check phpinfo() output, first table: it has the config files used by that PHP installation. Commented Jun 29, 2020 at 16:16
  • Yes, you are right. I was editting wrong php.ini. The correct one is shown in Loaded Configuration File from phpinfo(). Thanks! Commented Jun 29, 2020 at 16:31

2 Answers 2

1

You must be editing wrong php.ini file.. or have Xdebug settings defined in a separate .ini file (that is parsed in addition to the master file).

On Linux & Mac it's quite common to have different php.ini for CLI and web server.

Check phpinfo() output, top table: it will show all config files used by that PHP installation.

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

9 Comments

I'm running into the same issue and I can see the remote_host value change so I'm definitely not editing the incorrect php.ini file (technically, I'm editing the 20-xdebug.ini in /etc/php/7.2/cli/conf.d/ )
@Scott 1) What are you trying to debug: CLI script or a web page. 2) Please share whole phpinfo() output captured using the same environment where you are trying to debug. 3) Is this some "static"/traditional setup .. or a Docker container?. You better post it all as a new question here on SO.
I have a feeling that either phpstorm is doing something wrong or it's not parsing the value properly. but in my case, the problem turned out to be a misunderstanding of which way the actual xdebug traffic was going. I was aware the local machine makes a request but eventually figured out the side running the code then tries to talk 'back' to the address it received the request from. Once I realized this, I had to work out a janky work-around due to a firewall on this end in front of a NAT. (cont)
What I ended up doing was using the ssh connection I set up to forward local port 9000 (xdebug) to the remote computer to also forward the remote ssh port (22) back down to the local machine on port 10022. I start that and keep it open, then I set up PhpStorm to use the local port 10022 to do all of it's interaction with the remote. The remote then sees 'localhost' as the requesting machine and talks back to 127.0.0.1 instead of my NAT's public IP. That way the response comes back through port 9000 via the tunnel.
@Scott To me it sounds like some misunderstanding and therefore user misconfiguration of Xdebug. For CLI mode, IDE passes some of the Xdebug settings via command line when executing PHP script (values will differ for local/remote). It then starts to listen on Xdebug port (locally of course). Xdebug gets in when PHP executes the code. The "debug me" flag is passed by IDE for CLI. It's Xdebug that connects to IDE and NOT other way around (the most common mistake/assumption made).
|
0

Was also stuck 1+ hours on this problem, because the error message is not very helpful and sometimes misleading.

Maybe it's obvious, but try the following if everything else fails:

  • place a phpinfo() somewhere in your project to read out your currently applied php.ini configuration
  • open the php.ini you see under "Loaded Configuration File" in your phpinfo
  • edit your debug config
  • restart your webserver (This seems to be required when you start Laravel via "php artisan serve", at least in my case)
  • load your phpinfo again to confirm that your settings have been applied
  • run your PhpStorm debug config validator again

Your webserver and PhpStorm should now pick up your new debug configuration.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.