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
- ; Added for xdebug
- zend_extension="/usr/lib/php/20160303/xdebug.so"
- xdebug.remote_enable=1
- xdebug.remote_autostart = 1
- xdebug.remote_handler=dbgp
- xdebug.remote_mode=req
- xdebug.remote_host=localhost
- xdebug.remote_port=9000
- 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.