Before installing PHP CLI and PHP-XDEBUG on Linux, you should update the system repositories. This ensures that all of your systems software is up-to-date, reducing the likelihood of compatibility issues. Open a terminal and run the following commands.
sudo apt update sudo apt upgrade -y
Next, run the following command to install PHP CLI:
sudo apt install php-cli
And finally, run the following command to install PHP-XDEBUG but take care to use the correct version:
sudo apt install php8.3-xdebug
Notice: Install the corresponding version to ensure that both PHP CLI and PHP-XDEBUG versions match. Install PHP-XDEBUG version 8.3 only if you have already installed PHP CLI version 8.3 in the previous step.