PHPStrom is a great IDE. I really like it. But I bumped into an issue. I can't find instructions how to configure debugging for Yii console application. I set debugging for Yii web application and it works fine. Any help will be highly appreciated.
Upd1: Actually I figured out that there are 3 cases of the Yii console application.
Standard Yii console application (command files in the protected/commands folder of the webapp)
Standalone Yii console application (independent console aaplication without web application)
[My case] YiiBooster console application (YiiBooster has advanced, but good structure for medium or big projects)
You can find it in the extension window and install it. After installation, you must reload the VSCode window. Now, again run phpinfo(); method in any PHP file to check if Xdebug is enabled or not. Now click on the debug console tab and click on add configuration.
inurl:?XDEBUG_SESSION_START=phpstorm. Google Search: inurl:?XDEBUG_SESSION_START=phpstorm. #Google Dork : inurl:?XDEBUG_SESSION_START #Summary: Xdebug is a php extension that allows to debug php pages, remotely by using DGBp protocol. - Code execution is possible through eval or property_set xdebug commands. -
After some period of time I found the solution. In my case it must be split in 2 parts:
Install it and make sure that XDebug is activated (phpinfo() must return xdebug section in the response). Use the following link for detailed instructions
Set XDebug as debugger for PHP in Project Settings
[The steps below are specific for Yii console application debugging]
Find yiic.php file in your project and Run or Debug it first time.
After this go Run->Edit Config and set name of your command in the arguments with required parameters.
Now set breakpoints in your code and activate "Listen debugger connections” button.
If you want to use actions (like actionRebuildIndexes) in the command it needs to call the parent::run method in the run() function.
public function run($args) { parent::run($args); return 0; }
There is article in jetbrains blog about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With