[PHP + xdebug] configure the xdebug debugging environment in PhpStorm under Ubuntu14.04
I have referenced some articles in the configuration process, including both Chinese and English .. however, this problem cannot be completely solved. after some twists and turns, we can finally debug it. now we have recorded the following records, hoping to help later users.
1. install xdebug
Step 1: Get the local PHP configuration information
Run: php-I> outputphp.txt on the terminal
Then copy the information in the resulting txt file and copy it to a textarea provided on the http://xdebug.org/wizard.php page. click the Analyze button below to automatically parse your local PHP environment information and obtain the xdebug version and related configuration commands you need to download.
Step 2: Get the version and related commands to be downloaded
For example, the following information is obtained:
- Download xdebug-2.3.2.tgz
- Unpack the downloaded file with tar-xvzf xdebug-2.3.2.tgz
- Run: cd xdebug-2.3.2
Run: phpize (See the FAQ if you don't have phpize.
Some outputs are as follows:
Processing ING:
...
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
If the above output is not available, it indicates that your phpize has a problem. refer to the FAQ.
Run:./configure
- Run: make
- Run: cp modules/xdebug. so/usr/lib/php5/20121212
The above steps may require sudo.
Step 3: Add configuration items to php. ini
Sudo vim/etc/php5/cli/php. ini
Zend_extension =/usr/lib/php5/20090626/xdebug. so
Xdebug. remote_host = 127.0.0.1
Xdebug. remote_enable = 1
Xdebug. remote_port = 9000
Xdebug. remote_handler = dbgp
Xdebug. remote_mode = req
If not necessary, the preceding configuration items do not need to be modified. previously, I changed the remote_port item to the port number of my application on the Server, leading to the failure of debugging. it took some time to locate the problem.
Here, xdebug is successfully installed. can you use php? Verify the version command:
PHP 5.5.9-1ubuntu4. 7 (cli) (built: Mar 16 2015 20:47:39) Copyright
(C) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c)
1998-2014 Zend Technologies
With Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
With Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
Xdebug information already exists in the output.
2. install Xdebug extension helper
Xdebug extension assistant plug-ins are available in mainstream browsers to help you easily enable or disable debugging functions. For more information about the plug-ins, see section 4, 5 in this article, section 6 (in english. if you are interested, you can check it yourself)
Taking Chrome as an example, find the plug-in installation address here:
Https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc? Hl = en
If the plug-in cannot be opened, you can refer to this article to introduce how to use the plug-in ID for offline download. after all, Google's services are fully protected by the wall .....
The plug-in ID of Xdebug helper is eadndfjplgieldjbigjakmdgkmoaaaoc.
After installation, open the options of the plug-in and set IDEKey to PhpStorm.
3. configure PhpStorm
Finally, this step is very simple.
SelectRunUnder the menuStart Listening for PHP Debug Connections.
Then, place a breakpoint where you need to debug it, and enter the PHP script address in the browser. Note that you need to enable the previously installed Xdebug Helper.
You can enable the following methods:
OK. have fun debugging !!!
Principle (referenced on the xdebug official website)
References:
Https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
Http://icephoenix.us/php/how-to-setup-local-php-debugging-with-phpstorm-and-xdebug/
Http://xdebug.org/docs/remote#starting