Install Xdebug in MAC+PhpStorm environment

*文
Release: 2023-03-18 09:06:01
Original
2605 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Continue the process

$ ./configure$ make$ cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20131226
Copy after login

Finally create the /etc/php.ini file

vi /etc/php.ini
Copy after login

Add this line

zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
Copy after login

Restart the web server

apachectl restart
Copy after login

Use phpinfo to check if Installation successful

<?php phpinfo(); ?>
Copy after login


Install Xdebug in MAC+PhpStorm environment

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
Copy after login

PhpStorm-Configuring xdebug

Open PhpStorm and view the basic information of xdebug

Install Xdebug in MAC+PhpStorm environment

The port here needs to be the same as /etc/ The port of xdebug.remote_port in php.ini is the same

Install Xdebug in MAC+PhpStorm environment


Click Edit Configurations

Install Xdebug in MAC+PhpStorm environment


New PHP Web Application

Install Xdebug in MAC+PhpStorm environment


##Configure basic information


Install Xdebug in MAC+PhpStorm environment

Configuring Server


Install Xdebug in MAC+PhpStorm environment

Now, complete!

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!