This article mainly introduces how to use phpstorm + Xdebug to Debug PHP. For more information, see
Running environment:
PHPSTORM version: 8.0.1
PHP version: 5.6.2
Xdebug version: php_xdebug-2.2.5-5.6-vc11-x86_64.dll
Ps: php and xdebug versions must correspond to each other
1. install xdebug extension in PHP
For php. ini configuration, the following configuration is for reference only, and the path should be replaced with your own!
[Xdebug]
Zend_extension = "D: \ wamp \ php-5.6.2-x64 \ ext \ php_xdebug-2.2.5-5.6-vc11-x86_64.dll"
Xdebug. remote_enable = On
Xdebug. remote_handler = dbgp
Xdebug. remote_host = localhost
Xdebug. remote_port = 9000
Xdebug. idekey = PHPSTORM
Ps: remote_handler, remote_host, and remote_port all have default values. However, we recommend that you set these parameters at least ~
View phpinfo ~
2. PHPSTORM settings
The landlord used zendstudio all the time. it was very painful to use phpstorm at the beginning. after using it for a while, I found it quite useful ~
1. check the xdebug configuration of phpstorm.
The debug port here must be consistent with xdebug. remote_port in php. ini! The default value is 9000. if Port 9000 is occupied, you can change it to another port.
2. set debug.
Add a local web server ~
Www.51open. pcom is my local web server ~ ~
3. start debugging
Set the first breakpoint and shift + F9.
Set the first breakpoint, select the debug configuration, and press the bug button next to it.
Summary:
Based on the breakpoint configuration, or when the Debug URL is enabled, or after the POST, if PhpStorm listens to the Debug connection, it will immediately switch to the editor interface and jump to the breakpoint, the browser will wait for PhpStorm operations.
You can interrupt PhpStorm debugging at any time, or conveniently perform Step Into/Step Over/Run to cursor (this crash occurs ):
Oh, I don't want to debug it, but PhpStorm always jumps out? Remember the call button. just click it and make it red.