Home >Backend Development >PHP Tutorial >Install Xdebug in MAC+PhpStorm environment
Xdebug is a powerful PHP program debugger. For PHP developers, Xdebug is a must-have tool. This article uses MAC as the basic environment to install Xdebug and configure PhpStorm.
Install xdebug
Use brew to install xdebug, the syntax is as follows
brew install homebrew/php/php<version number>-xdebug
Go to https://xdebug.org/download.php to download xdebug, the version must be the same as The corresponding version of php
brew install homebrew/php/php56-xdebug
If you don’t know which version of xdebug to download, the xdebug website has a place where you can check it. Copy your entire phpinfo() information into the text box, and then click Analyse my phpinfo( ) output button, there will be a corresponding introduction to the installation process.
Check the existing php version
$ php -vPHP 5.6.32 (cli) (built: Oct 27 2017 11:56:18) Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
After the download is complete, unzip the compressed file. Copy the entire decompressed file directory to the /usr/local/Cellar/php56/5.6.32_8/ directory
$ cd /usr/local/Cellar/php56/5.6.32_8/$ phpize
If the following message appears, it means you can continue to the next step
Configuring for:PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226
Continue the process
$ ./configure$ make$ cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20131226
Finally create the /etc/php.ini file
vi /etc/php.ini
Add this line
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
Restart the web server
apachectl restart
Use phpinfo to check if Installation successful
<?php phpinfo(); ?>
Although /etc/php.ini has default configurations, it is best to write down these configurations
xdebug.remote_enable = Onxdebug.remote_handler = dbgp xdebug.remote_host= localhost xdebug.remote_port = 9000xdebug.idekey = PHPSTORM
PhpStorm-Configuring xdebug
Open PhpStorm and view the basic information of xdebug
The port here needs to be the same as /etc/ The port of xdebug.remote_port in php.ini is the same
Click Edit Configurations
New PHP Web Application
Related recommendations:
PHPstorm shortcut key introduction summary
A brief introduction to the method of installing the Xdebug extension of the PHP7 debugging tool
How to use Xdebug + Sublime Text 3 to debug PHP code
The above is the detailed content of Install Xdebug in MAC+PhpStorm environment. For more information, please follow other related articles on the PHP Chinese website!