Installing Xdebug extension for PHP in CentOS

Time:2021-3-16

XdebugyesPHPAn extension of to help developers debug and develop.

Here, take PHP installed by source code compilation as an example, if it isyumoraptFor PHP installation, please refer to the official website:Installation Xdebug

Download Xdebug source code

wget https://xdebug.org/files/xdebug-2.9.2.tgz

decompression

tar -xzf xdebug-2.9.2.tgz

Compile and install

cd xdebug-2.9.2/ 

implementphpizeCommand, which is usually in thephpInstallation directory forbinUnder the table of contents:

/usr/local/php/bin/phpize

Then there is the compilation and installation/usr/local/php/bin/php-configThe path is also located in thephpIn the installation directory:

./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
make && make install

to configure

findphpconfiguration filephp.iniIt’s usually in thephpInstallation directoryetcAt the end, add:

[Xdebug]
zend_extension="xdebug.so"

be careful: if you want to use them togetherXdebugandOPCache, you mustOPCacheAdd after configurationXdebugthat ‘s ok. Otherwise, they will not work properly.

last

Restart the relevant service (PHP FPM) to make it work, and then you canphpinfo()Page viewXdebugThe module is ready.

It can also be passed under commandphp -mLists all installed modules.