How to Install Xdebug - Part 2

Here are instructions for installing xdebug on a version of PHP that is not your system’s default.

  1. 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( );

?>
  1. Navigate browser to domain.com/info.php
  2. 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.
  3. 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
  4. Unpack the file tar -xvzf xdebug-3.1.3.tgz
  5. Run cd xdebug-3.1.3
  6. 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.
  7. 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
  8. 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
  1. 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

  2. Run

sudo ./configure --enable-xdebug --with-php-config=/usr/local/lsws/lsphp73/bin/php-config
  1. Run sudo make
  2. Run cp modules/xdebug.so /usr/local/lsws/lsphp73/lib/php/20180731
  3. Run nano /usr/local/lsws/lsphp73/etc/php/7.3/mods-available/99-xdebug.ini and add zend_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.

  1. Restart the web server.
  2. Navigate to domain.com/info.php and you should see something like this

If you don’t, try clearing the browser cache.

2 Likes