In this guide, we will explain how to install Xdebug using the command line. Xdebug is a powerful debugging tool for PHP that helps with debugging and profiling PHP applications.
Here is a step-by-step guide to installing Xdebug using the command line:
- Use SSH or the WHM / Terminal interface to log in as the root user to the server.
- Type the PHP version you want to use into the PECL command line.
/opt/cpanel/ea-phpXX/root/usr/bin/pecl
Note: Substitute XX with the PHP version you wish to install Xdebug on.
- Execute the command PECL install:
/opt/cpanel/ea-phpXX/root/usr/bin/pecl install xdebug
- Check the extension is installed:
/opt/cpanel/ea-phpXX/root/usr/bin/php -m | grep xdebug
- Only Xdebug should come back if Xebug is installed.
[root@server ~]# /opt/cpanel/ea-php81/root/usr/bin/php -m | grep xdebug xdebug
- You need to restart Apache and PHP-FPM after installing Xdebug.
/scripts/restartsrv_httpd /scripts/restartsrv_apache_php_fpm
This way, you can install Xdebug using the command line. Hope you liked this article.
To further enhance your development process, learn How to access the Web Server Command Line through cPanel