Xdebug Cli Phpstorm



In host:

Xdebug Cli Phpstorm
  1. Go to PHPStorm Settings > Project settings > PHP > Servers
  2. Add server with following parameters:
    • Name: vagrant (same as serverName= in debug script)
    • Host, port: set vagrant box IP and port
    • Debugger: Xdebug
    • [v] Use path mappings
    • Map your project root in host to relative dir in guest
    • Hit OK
  3. PHPStorm > Run > Start listen for PHP Debug connections
  4. Put a breakpoint

Configure phpstorm: In Settings Languages & Frameworks PHP Servers create a new entry. Give it a name (e.g. Localhost) and set the Host to 'localhost' (needs to match the serverName defined in your PHPIDECONFIG environment variable. Set the port to 80 and choose Xdebug as a debugger. Change the Xdebug port to 9001 in the Languages & Frameworks PHP Debug Xdebug Debug Port panel. The following steps describe debugging web requests and CLI commands. To debug web requests: In your PhpStorm project, click (Start listening) in the top navigation bar. Add breakpoints in the pub/index.php file. Phpstorm xdebug cli docker. Debugging PHP (web and cli) with Xdebug using Docker and, Ports configuration. Keep in mind that PHPStorm opens port 9000 (by default) so Xdebug can connect to it. Our PHP container has Xdebug Move to your favorite Docker project in PHPStorm; Configuring Docker. It is possible to run PHP cli without a docker-compose file, I have found it is easier to set up PhpStorm using this intermediate step. PhpStorm has several preconfigured Docker containers, source: Github - JetBrains / phpstorm-docker-images; Docker hub - PhpStorm; They can be used as follows: Php 7.3 CLI and XDebug 2.7.

Xdebug Cli PhpstormCli

In guest:

Phpstorm Xdebug Cli Interpreter

  1. Find where your Xdebug config is stored. Run $ php -i | grep ini and look for *xdebug.ini or *custom.ini - depends on configuration (mine was in /etc/php5/cli/conf.d/zzzz_custom.ini)
  2. Add following xdebug.remote_host = 11.22.33.1, when box ip is 11.22.33.*
  3. Create file /usr/bin/debug with contents added below (file debug below)
  4. Make it executable $ sudo chmod 0777 /usr/bin/debug
  5. Run your script prefixed with debug:
    • $ debug app/console cache:clear
  6. Debugger window should open in IDE