Run xdebug with quick setting

Many people have problems in enabling the xdebug module to debug their code. Let’s see how easy it’s to run xdebug with quick setting.

Steps to run xdebug

Step 1

Install xdebug if not already installed. after installation check whether it’s installed correctly or not (using phpinfo();)

Step 2

Edit php.ini and paste the sample of code:

If you are using Ubuntu, your php.ini path is something like /etc/php/7.1/apache2/php.ini

If you are using the console application of PHP, the path will differ: /etc/php/7.1/cli/php.ini

  1. ; Added for xdebug
  2. zend_extension="/usr/lib/php/20160303/xdebug.so"
  3. xdebug.remote_enable=1
  4. xdebug.remote_autostart = 1
  5. xdebug.remote_handler=dbgp
  6. xdebug.remote_mode=req
  7. xdebug.remote_host=localhost
  8. xdebug.remote_port=9000
  9. xdebug.profile_enable=1

change the above code according to your requirement

Step 3

Restart apache, if you want to use it instantly.

Now tell your editor to listen for xdebug.

Leave a Reply