IntelliJ IDEA中的PHP调试

Ok, I'm probably stupid but I cannot make it to work.

The setup is:

  • Ubuntu
  • apache2
  • xdebug
  • IntelliJ IDEA 11.1.3 Ultimate
  • IntelliJ IDEA PHP Plugin

xdebug is installed.

I would like to debug Drupal site, on my local machine, the project is here:

/var/www/luken/my-site

and URL is here:

http://localhost/luken/my-site

Because I couldn't create a project from existing sources, I created new project (web module) from scratch there. Now the thing is that if I'm running configuration for "PHP Script" - debugger works. But if I try to use configuration for PHP Web Application (so project would be opened in browser) it cannot connect to debugger. I tried a lot of things, and different mappings but obviously I'm missing something stupid. How configuration should look with above setup?

Of course. I found answer few minutes after posting a question, regardless of hour of investigation before, but here it is:

I read somewhere wrong information that you doesn't need to configure xdebug. In reality, you need to modify /etc/php5/conf.d/xdebug.ini . I added there:

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Which I read about in article about configuring Netbeans, and the thing worked. And precisely:

xdebug.remote_enable=1

^ This line is only required.

In case you're using PHPs command line interface (cli), a different php.ini is being used. Thus, either edit the /etc/php/version/cli/php.ini, or specify a php.ini explicitly, like

php -S localhost:8080 -t "/var/www/html/my_project" -c "/etc/php/7.0/apache2/php.ini"