Phpstorm + xdebug Remote Breakpoint debugging

Source: Internet
Author: User
Tags php debug

Xdebug Introduction

Xdebug is a PHP debug tool that is based on an zend extension that can be used to track, debug, and analyze the health of PHP programs. such as variables, function debugging, performance monitoring, code coverage, etc.

Xdebug Installation

1. Download the Xdebug source program

git clone git://github.com/xdebug/xdebug.githttps://xdebug.org/download.php#releases

2. Unpack the Xdebug package
tar -xzvf xdebug.tgz

3. Go to unzip directory
cd xdebug

4. Running Phpize
/usr/local/php/bin/phpize

5. Compiling
./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config

6. Installation
make && make install

7. After successful installation, an extension similar to xdebug.so will be generated in the PHP extension directory.

8. Install Xdebug client xdebugclient (requires Libedit extension)

CD debugclient./configure--with-libeditmakemake Install
Xdebug Configuration

1. Add the following in the php.ini configuration file
zend_extension="/wherever/you/put/it/xdebug.so"
2. If it is thread-safe prior to php5.3, add the following to replace the above 1 content
zend_extension_ts="/wherever/you/put/it/xdebug.so"
3. Since php5.3 Zend_extension_ts, Zend_extension_debug no longer uses

4 Some other configuration of the. Xdebug

4. Restart PHP for the configuration to take effect

Performance Analysis Log Tool

1.linux Platform

Tool Kcachegrind (Linux, KDE) https://kcachegrind.github.io/

2.win Platform View Tool Wincachegrind

Related URLs

http://ceefour.github.io/wincachegrind/https://sourceforge.net/projects/wincachegrind/https://github.com/ ceefour/wincachegrind/releases/tag/1.1

Column name meaning

Self-shows the execution time of the code in the current block

Cum.-Shows the total exuction time of functions, the current function (self) calls

Avg vs. Total:average is Average time per call, and total is the total time spend of all calls.

3.Web Way to view Webgrind

Https://github.com/jokkedk/webgrind


Xdebug configuration:

1. Installation Xdebug slightly. There is a lot of information online.

Key to write php.ini configuration

[XDebug]
zend_extension= "/usr/lib/php5/20090626+lfs/xdebug.so"
Xdebug.default_enable = On
Xdebug.collect_params = On

Xdebug.remote_connect_back = ON//If this is turned on, the following xdebug.remote_host parameters are ignored. < A webserver with multiple developers working directory, such as: p1.xx.com,p2.xx.com,p3.xx.com ... such as >
xdebug.remote_host = 192.168.59.104//Note here is that the client's ip< is the IP of the IDE's machine, not your web server>
Xdebug.remote_port = 9900//Note here is the port of the client < The IP of the IDE's machine, not your web server>
xdebug.remote_enable = on
Xdebug.remote_handler = DBGP
Xdebug.remote_log = "/var/www/xdebug/xdebug.log"
xdebug.remote_req = req
xdebug.auto_trace = Off
Xdebug.remote_autostart = on
xdebug.show_exception_trace = 0
xdebug.collect_vars = on
Xdebug.collect_return = on
xdebug.collect_params = on
xdebug.var_display_max_depth =
xdebug.show_local_vars = 1
xdebug.dump_undefined = 1
xdebug.profiler_enable = 1
Xdebug.profiler_output_dir =/var/www/xdebug

Phpstorm configuration:
1.file->setings->php| Debug to the right. That piece of xdebug. Set the Debug port:9900 (set here is, Xdebug spits out the debug information, through what port of this machine transmits. )

2.file->setings->php|  Servers to the right.   Host: Your Web server's domain name or IP, port, the following use path mapping means, the directory of your project, the corresponding server, what directory? It must be set here! Otherwise, a file cannot be found and an error occurs, which leads to the debug termination.

3.run->edit Configurations-> Adds a PHP WEB application to the tuning pilot.  Right: Server selects the server you created above. StartURL Set your portal file.

At this point, the configuration is complete!


Such a request, you can register a debugging client Oh!

Http://www.aihuxi.com/****.php? xdebug_session_start=19192


Click, bug icon, you can start debugging!




Phpstorm + xdebug Remote Breakpoint debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.