1. Environment
Xdebug is an opensource Debugger and Profiler for PHP. PDT has built in support for Xdebug, which allows you to step-debug through your PHP projects. The first step is to install Xdebug and verify that Xdebug is running. See the Installation section of the Xdebug manual for how to obtain the extension. PhpStorm supports debugging with two most popular tools: Xdebug and Zend Debugger. These tools cannot be used simultaneously because they block each other. To avoid this problem, you need to update the corresponding sections in the php.ini file as described in Configure Xdebug and Configure Zend Debugger. If you wish to debug a request sent by Postman, all you need to do is add XDEBUGSESSIONSTART=PHPSTORM as a key-value pair to the request body and start the debug config as you would when debugging via Chrome.
This blog post describes step by step tutorial to debug PHP applications with Visual Studio Code using XDebug extension on localhost.
Mine environment has:
- Wampserver 3.1.0 32 bit x86
- Apache 2.4.27 – PHP 5.6.31
- MySQL 5.7.19
- Visual Studio Code 1.20.1
- XDebug
In my current set-up of XDebug, using PHPStorm and the Bookmarklet provided I'm able to get it working in both Chrome and Firefox - but as soon as I try with POSTman or any other REST client, I can't figure out how to get it started. Hay all, Please suggest me the change for xdebug.ini file in laradock/php-fpm, So I can run in xdebug in POSTMAN COLLECTION. Set the url with?XDEBUGSESSIONSTART=DOCKERTEST and set a header Cookie: XDEBUGSESSION=DOCKERTEST.
2. Configure XDebug
Xdebug Debug Postman
Open the php.ini file (usually located at: c:wampbinapacheapache2.4.27binphp.ini) and add the following lines at the end of file:
Also, comment this line:
3. Install and configure XDebug add-on for your favorite web browser
For Chrome, you can download/install it from here.
Adobe photoshop cs6 download for pc full version. For Firefox, you can download/install it from here.
Configure the extension to have proper IDE Key: PHPSTORM
4. Configure VS Code
Xdebug Phpstorm Postman
– Install VS code plugins for PHP. For debugging PHP Debug plugin is required.
After installation, configure PHP intellisense on user level:
File > Preferences > Settings
and add the following section under user settings area:
Do not forget to change “php.validate.executablePath” to the proper path which you are using.
5. Debug
– Run the xdebug listener in your browser from which you run the website:
– Open your PHP project in VS Code and click on 1st step (check the screenshot):
After click on settings button (2nd step) you should get a dropdown to pick a language for debug configuration. Pick PHP.
This confiig is saved per project under: your-site-root-folder/.vscode/launch.json.
Click save file and click on the debug button (3rd step).
After that, your debugger should be ready for incoming connections and you can put a breakpoint so you can debug.
After page reload (in your web browser), VS Code should break the execution at the breakpoint which you have previously set. Example: