Reference: http://www.cnblogs.com/imayanlong/p/6375950.html, https://segmentfault.com/a/1190000004505815
1. Configure Xdebug
To configure Xdebug related parameters, add the following configuration to the php.ini file. If it is not installed, please refer to " Installing Xdebug Extensions in PHP ":
[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
Restart Apache and check whether the configuration takes effect.
Second, configure PHPStorm
1.
Configuration Servers
, the main configuration items are as follows:
Mac path: PHPStorm->Preferences->Languages & Frameworks->PHP->Servers
Win path: File->Settings->Languages & Frameworks->PHP->Servers
2.
Configuration Debug
, make sure the Debug port corresponds to the above, other options are default:
Mac path: PHPStorm->Preferences->Languages & Frameworks->PHP->Debug
Win path: File->Settings->Languages & Frameworks-> PHP->Debug
Enable Debug Listening in PHPStorm: Click Run->Start listening for PHP Debug Connections, then click the lower triangle in the upper right corner to set:
image description
You can choose to create a new PHP Web Application or PHP Script. If you choose a PHP Web Application, you need to configure the Server. By default, the local development and the route are localhost. The configuration is as follows:
image description
Here is an example of PHP Script, as follows:
Picture description
Then click the crawler icon in the upper right corner to perform debugging, and each variable value is displayed in the debug console:
image description
I talked about configuring Xdebug in PHPStorm. No matter what, you must configure Xdebug, which is very useful when reading code, especially Laravel source code.