Here are instructions for installing xdebug on a version of PHP that is not your system’s default.
- Create a file named
info.php
in the root of the site that is using the php version you want to install xdebug for. e.g./home/domain.com/public_html/info.php
add this code to it
<?php
phpinfo( );
?>
- Navigate browser to
domain.com/info.php
- Copy the entire page and paste it into the textbox at this Xdebug install wizard. Click the Analyse button and follow the first few steps on that page.
- In your server’s ssh root (run
cd
), use wget to download the xdebug source file. e.g.wget https://xdebug.org/files/xdebug-3.1.3.tgz
- Unpack the file
tar -xvzf xdebug-3.1.3.tgz
- Run
cd xdebug-3.1.3
- If this site is using your system’s default php version, continue with the instructions on that page. They will work. If it is for an alternative version of php, continue with these instructions.
- The key concept here is to use the correct version of “phpize”. to find the “phpize” for your php 7.3 just run this command:
sudo find / -name "phpize"
.
In my case it was at/usr/local/lsws/lsphp73/bin/phpize
- Run
sudo /usr/local/lsws/lsphp73/bin/phpize
You should get this output. If you see other numbers for API versions it means the “phpize” is not for php 7.3
Configuring for:
...
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
-
Now we need to find the configuration file location for php 7.3.
sudo find / -name "php-config"
Mine was at/usr/local/lsws/lsphp73/bin/php-config
-
Run
sudo ./configure --enable-xdebug --with-php-config=/usr/local/lsws/lsphp73/bin/php-config
- Run
sudo make
- Run
cp modules/xdebug.so /usr/local/lsws/lsphp73/lib/php/20180731
- Run
nano /usr/local/lsws/lsphp73/etc/php/7.3/mods-available/99-xdebug.ini
and addzend_extension = "/usr/local/lsws/lsphp73/lib/php/20180731/xdebug.so"
to the file, add other config parameters such as
xdebug.mode = debug, develop
xdebug.start_with_request = trigger
xdebug.client_port = 9003
xdebug.connect_timeout_ms = 200
xdebug.idekey = VSCODE
xdebug.trigger_value = [enter the passkey you want to use in your browser xdebug extension]
Then press Ctrl+O to save and Ctrl+X to exit.
- Restart the web server.
- Navigate to domain.com/info.php and you should see something like this
If you don’t, try clearing the browser cache.