Postman Xdebug Phpstorm



August 11, 2016Yann Jacquot6 min read

  1. Postman Xdebug Phpstorm Free
  2. Postman Xdebug Phpstorm 9
  3. Xdebug Phpstorm Cli
  4. Postman Xdebug Phpstorm Activation
  5. Phpstorm Setup Xdebug

Warning: this article concerns php5 version. If your PHP version is different, replace php5 by php/X.Y in paths (X.Y is your PHP version) and phpX.Y in command. For example :

  • sudo apt-get install php5-xdebug becomes sudo apt-get install php5.6-xdebug
  • /etc/php5/mods-available/xdebug.ini becomes /etc/php/5.6/mods-available/xdebug.ini

I love debuggers. They allow me to understand deep down in my code why something doesn't work, and are even more useful when I work on legacy projects.
When I work on the client side, the browser already provides me all the tools I need to dig deeper than some console.log() scattered semi-randomly in the source code.
However, I struggled to configure my workspace when I worked on a PHP Symfony2 project hosted in a Vagrant virtual machine.

You can also set it as a cookie (delboy1978uk.wordpress.com/2015/05/26/using-xdebug-with-postman). But both are not necessary. It is important that you set it up correctly in PHPStorm under PHP Remote Debug. If xdebug.idekey is configured, you can also set the value here. Jetbrains.com/help/phpstorm/ jetbrains.com/help/phpstorm/. Make sure that the Xdebug port in phpstorm is also 9000 (the same as wamp’s Xdebug port): File Setting searches Xdebug in the search box. Note that if you use nginx + php-fpm, then the 9000 port may be occupied by php-fpm, please replace the port, such as 9001.

Step1: Install Xdebug on your Vagrant virtual machine

That may seem obvious, but you need to have Xdebug installed on your virtual machine to benefit from its services.

Then, configure it:

with the following lines:

Finally, if you use php5-fpm, you need to restart it:

Postman Xdebug Phpstorm

If you use Ansible to provision your virtual machine, you can also use a ready-to-action Xdebug role.

  1. Fix Xdebug on PhpStorm when run from a Docker container. Long story short: There is a bug in the networking setup of Docker for Win that makes PhpStorm use the wrong remotehost when it starts a debugging session. When you take a look at the 'Console' panel at the bottom of the IDE, you should see something like this.
  2. Debugging with Postman and PHPStorm (Xdebug) Written by Mike August 6, 2018 Postman started out as an API development tool, but has developed more into, as they put it, an 'API Development Environment'. An over-simplified description is it allows you to create and save requests to test your API.
  3. 折腾-wordpress+grpc+java对接(4)vscode调试php - data羊的博客小屋 发表在《在 Windows 10 的 PHP 7.2 版本下安装 Xdebug》 基于 Composer 更新 Yii 2 至最新版本后,软件包:guzzlehttp guzzle 的丢失的分析 – 永夜 发表在《 基于 Composer 更新 Yii 2 至最新版本,将 Yii Framework 从 2.0.15.1.

Step2: Configure PhpStorm

First, select the 'Edit configurations' item in the 'Run' menu.

Then, add a new 'PHP Remote Debug' configuration.

We will use the IDE key configured in your Vagrant and in your browser.
To fully configure this debugger configuration, you will need to create what PhpStorm calls a server.

Postman xdebug phpstorm extension
  • Fill the correct hostname
  • Check 'Use path mappings' checkbox, and write the project's absolute path
    on your Vagrant virtual machine

Step3: Configure Xdebug

Use Xdebug to debug your web application on Chrome

Now that Vagrant with Xdebug is up and running, let's configure Xdebug Chrome extension.

First, we need to install it from Chrome Web Store

Make sure that the extension is enabled on your browser's extensions list page.

Now, you should see on the right side of the address bar the extension's symbol.

Right-click on it, then click on the 'Options' sub-menu.

You have to use the IDE key previously set. Lorenzo romano amedeo carlo avogadro.

Xdebug plugin also exists for other browsers.

Finally, in your browser click on the bug in your address bar to switch to the 'Debug' mode

Postman Xdebug Phpstorm Free

Phpstorm

Use Xdebug to debug your APIs route with Postman

Postman

Once your Xdebug configuration is added, you need to add ?XDEBUG_SESSION_START=_<XDEBUG_KEYNAME>_ at the end of your route. And that's all!

Use Xdebug to debug commands or unit tests

To use Xdebug for debugging commands or unit tests, first, you need to add xdebug.remote_autostart=true in XDebug configuration file of your Vagrant xdebug.ini.

Then, you need to specify the xdebug.remote_host French montana a lie ft the weeknd max b mp3. (IP address of your local from your Vagrant) when launching the command from the virtual machine’s terminal.

  • First, get the host IP address by using ifconfig from your local terminal (the host) :
  • Then, launch your command

For instance, if you want to debug your unit tests in a Symfony project, you can run:

Postman Xdebug Phpstorm 9

Step4: Enjoy!

Now, in PhpStorm you:

  • Add your breakpoints by clicking to the left of the lines
  • Click on the bug icon on the upper-right corner

You should now be able to break on the exact line you selected in your IDE.

Bonus: Performance

You need to know that enabling Xdebug slows down your app (x2), the fastest way to disable it is to run the following command: php5dismod xdebug

Use php5enmod xdebug to enable it back. Each time you'll also need to restart php-fpm or apache.

Phpstorm

Troubleshooting: I did the tutorial but Xdebug doesn’t work

Xdebug Phpstorm Cli

It’s probably because a symbolic link is missing in your php conf.

  • First type in your virtual machine php -i | grep xdebug

Postman Xdebug Phpstorm Activation

If you have no response, it means Xdebug is not set correctly

  • Then check if Xdebug is mentioned when running php -v from your Vagrant.
  • If not, add a symbolic link to specify that the Xdebug module should be enabled, for instance (you may need sudo):
  • You should obtain by running php -v

Phpstorm Setup Xdebug

I hope you've made your way through the process and that it will improve your efficiency as much as it does for me. If you have other ways to configure your debugger, feel free to share them in the comments section below.