XDebug Configuration
Yii2 so much code, inevitably need to track debugging place, so xdebug is essential. Since XAMPP has been extended with Xdebu, it is only necessary to change the next php.ini file to enable this extension:
Zend_extension = "D:\xampp\php\ext\php_xdebug.dll" (as determined by the actual situation) xdebug.remote_enable =1xdebug.remote_handler = "DBGP" Xdebug.remote_host = "localhost" Xdebug.remote_mode = "req" Xdebug.remote_port = 9000
After enabling the extension, you can use Phpinfo to see if there is this extension. After that, it is guaranteed that PHP debugging information can be sent to the Remote_host Remote_port port. Then configure Phpstorm:
- Enter File>settings>php>servers, here to fill in the server side of the relevant information:
Name:localhost,
Host:localhost,
PORT:80,
Debugger:xdebug
- Go to File>settings>php>debug, find the Xdebug tab, Port 9000
- Enter FILE>SETTINGS>PHP>DEBUG>DBGP Proxy to fill in:
IDE Key:phpstorm
Host:localhost
Port:80
- Setup is complete, click OK to exit.
At this point, in fact, Xdebug and Phpstorm debugging preparation work has been completed, then there are two ways to achieve Phpstorm breakpoint debugging, method one:
PHP WEB Application
Run>edit configurations ... In the popup window, add a Debug configuration:
- Click the plus sign in the upper left corner to select PHP Web application
- Fill in the appropriate information in the right window:
- After filling out, click OK to close the Configuration window, point to the small beetle start debugging
Browser plugin
If you use Chrome or Firefox, you can install the browser plugin, which is the plugin for Chrome:
Click Options, open the Plugins Options page, set the following:
After installation, open http://localhost, you will see the browser address bar to the right of a small icon, click, select Debug:
In the Phpstorm, find the phone icon next to the Beetle, enable:
Set up, in the code to find a place to set a breakpoint, refresh the page, you should be able to stop. Then use a variety of debugging techniques to follow the debugging.
YII2 Day 2: Configuring Phpstorm