phpstorm debug laravel

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

phpstorm-servers.png

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

phpstorm-debug.png

 

 

 

 

 

 

 

phpstorm-xdebug-result.png

 

 

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.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325143493&siteId=291194637