Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to debug Phpstorm in command line and browser

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to debug Phpstorm on the command line and in the browser. I hope you will learn a lot after reading this article. Let's discuss it together.

First, install the xdebug extension for php first

1. Download xdebug, and place the downloaded files in the ext directory under the PHP installation path. By default, there is a zend_ext directory in the PHP5.5 installation package, or you can put it in this directory. Remember the installation path later (recommended Learning: phpstorm details)

(d:\ root\ wamp\ bin\ php\ php5.5.12\ ext\ php_xdebug-2.2.5-5.5-vc11.dll or D:\ wamp\ bin\ php\ php5.5.12\ zend_ext\ php_xdebug-2.2.5-5.5-vc11.dll)

2. Modify the php.ini. The associated xdebug takes effect if the xdebug takes effect.

; XDEBUG Extensionzend_extension = "D:/wamp/bin/php/php5.5.12/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll"; add the extension path of xdebug here (the path in step 1 is determined according to the path that your xdebug placed.) [xdebug] xdebug.remote_enable = on # debug xdebug.remote_port on xdebug = 9001 # xdebug debug listening port xdebug.remote_host = localhost # local listening host xdebug.idekey = phpstorm # key required for IDE assistance

3. Check whether the configuration is correct by visiting phpinfo

Second, the related configuration of Phpstorm

1. Basic debug settings. Click File- > Settings in the menu bar to open the dialog box. The drop-down menu on the left is Languages & Frameworks-> PHP-> Debug Settings.

Mainly configure Debug port: 9001, choose 9001 to prevent port 9000 from being occupied.

2. Open Debug- > DBGp proxy, and add the configuration item in php.ini here.

3. Change the servers,name of a new php to test,Host:localhost,port:80,Debugger:Xdebug, and save it.

This server is reserved for later configuration of specific debug to be used.

4. For the Debug settings of the project, click Run- > Edit configurations.., in the menu bar to open the dialog box.

1) add a new debug configuration, and currently select a new server for the project of php (just the server configured in step 3)

The new debug can be named name:debugphp,server: select the server we just configured

Start Url: which directory is the default. Of course, you can add it as you like.

Browser: just choose the browser you think is appropriate.

Third, start debugging

1. Add a breakpoint, open a PHP file in the root directory, select any line in the php file and right-click to add a breakpoint, or click on the header of the line.

2Jing shiftkeeper F9 or click the spider on the right side of the menu bar

3Query Phpstorm will open the browser and execute the program to capture the debug point. Back to the debug interface.

After reading this article, I believe you have a certain understanding of how to debug Phpstorm on the command line and in the browser. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report