close

How to install Xdebug on Ubuntu?

Hello Guys, How are you all? Hope You all Are Fine. Today we are talking about How to install Xdebug on Ubuntu? in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How to install Xdebug on Ubuntu Error Occurs?

Today we are talking about How to install Xdebug on Ubuntu? in php.

How To Solve install Xdebug on Ubuntu Error ?

  1. How To Solve install Xdebug on Ubuntu Error ?

    To Solve install Xdebug on Ubuntu Error please, disable ppa/php and run sudo apt install php-xdebug

  2. How to install Xdebug on Ubuntu?

    To Solve install Xdebug on Ubuntu Error please, disable ppa/php and run sudo apt install php-xdebug

Solution 1

First, you need to update local packages using the following command:

sudo apt update
# OR
sudo apt-get update

Now you can install xdebug with the following command:

sudo apt install php-xdebug

And configure it as:

sudo nano /etc/php/7.0/mods-available/xdebug.ini

Add the following code into it:

zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9005 #if you want to change the port you can change 

Note: Directory 20151012 is most likely to be different for you. cd into /usr/lib/php and check which directory in this format has the xdebug.so file inside it and use that path.

And then restart the services:

sudo systemctl restart php7.0-fpm
sudo systemctl restart nginx # If you are using nginx server
sudo systemctl restart apache2 # If you are using apache server

Solution 2

please, disable ppa/php and run sudo apt install php-xdebug

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment