Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Xdebug on Ubuntu?

Tags:

I'm trying to install xdebug on Ubuntu:

sudo apt-get install php-xdebug 

and getting following error:

Need to get 806 kB of archives. After this operation, 4.423 kB of additional disk space will be used. Err:1 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php-xdebug amd64 2.5.5-3+ubuntu17.10.1+deb.sury.org+1 404 Not Found E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/x/xdebug/php-xdebug_2.5.5-3+ubuntu17.10.1+deb.sury.org+1_amd64.deb 404 Not Found E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

How can I solve this problem ?

like image 968
godot Avatar asked Nov 03 '18 15:11

godot


People also ask

Where do I put Xdebug DLL?

There should be a folder /ext in your main PHP folder. You must also put the correct path in your php. ini.

How does Xdebug remote work?

When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it's running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).


1 Answers

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 
like image 57
engrhussainahmad Avatar answered Sep 27 '22 21:09

engrhussainahmad