Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install PHP Xdebug on Fedora / CentOS x64

PHP Xdebug installation on Fedora/CentOS x64

First, install xdebug package on system:

$ sudo yum install php-pecl-xdebug.x86_64

Or with DNF:

$ sudo dnf install php-xdebug

If your have an Nginx server, we should restart the PHP processor php-fpm:

$ sudo systemctl restart php-fpm

Or if you have a Apache server, we should restart the httpd server:

$ sudo systemctl restart httpd

Finally, verify if xdebug extension is loaded:

php -r "echo (extension_loaded('xdebug') ? 'xdebug up and running!' : 'xdebug is not loaded!');"

// xdebug up and running!
@muhammadatallah

This comment has been minimized.

Copy link

@muhammadatallah muhammadatallah commented Mar 19, 2016

Thanks

@josephx86

This comment has been minimized.

Copy link

@josephx86 josephx86 commented May 17, 2016

Thanks for the gist.

I have been trying to get xdebug working correctly in Eclipse Mars 2 (4.5.2) on Fedora 23. I got it working correctly after setting the xdebug.remote_enable option.

I have the revision at https://gist.github.com/josephx86/85c1413b25ee257e0543032aadfec7fc/revisions

@Canavell

This comment has been minimized.

Copy link

@Canavell Canavell commented Oct 26, 2016

thank you

@rahilwazir

This comment has been minimized.

Copy link

@rahilwazir rahilwazir commented Nov 5, 2016

You don't need to add the line to /etc/php.ini as the PHP loads it anyway.

@nickmendoza

This comment has been minimized.

Copy link

@nickmendoza nickmendoza commented Jul 20, 2017

Thanks in 2017.

@joseluisq

This comment has been minimized.

Copy link
Owner Author

@joseluisq joseluisq commented Sep 5, 2017

@rahilwazir It's true. Now is not necessary to add this line to php.ini. Updated!

@Verakhs

This comment has been minimized.

Copy link

@Verakhs Verakhs commented Nov 7, 2017

I would like to know whether upgrading to a new version will mess up with my old apps? recently I start getting such errors as follows:

/etc/cron.daily/0yum.cron:
Error: Package: php-pecl-xdebug-2.1.4-2.el6.x86_64 (epel)
Requires: php-common >= 5.3.3-38
Installed: php-common-5.3.3-27.el6_5.1.x86_64 (@sl-security)
php-common = 5.3.3-27.el6_5.1
Available: php-common-5.3.3-26.el6.x86_64 (sl)
php-common = 5.3.3-26.el6
Available: php-common-5.3.3-27.el6_5.x86_64 (sl-security)
php-common = 5.3.3-27.el6_5
/etc/cron.daily/cleanscratch:

Cleaning /srv/scratch space
/etc/cron.daily/freshclam:

/etc/cron.daily/freshclam: line 15: /usr/bin/freshclam: No such file or directory

@killrazor

This comment has been minimized.

Copy link

@killrazor killrazor commented Apr 3, 2018

@Verakhs There are some deprecated functions. You should check it out before upgrading. Or...if it isn't critical, just upgrade and watch for errors.

@djwave28

This comment has been minimized.

Copy link

@djwave28 djwave28 commented Apr 28, 2018

Ran into a minor issue with the last command to verify if xdebug is running on fedora 27. Apparently the double and single quotes are inverse. ran it successful with :

php -r 'echo (extension_loaded("xdebug") ? "xdebug up and running!" : "xdebug is not loaded!");'

@treii28

This comment has been minimized.

Copy link

@treii28 treii28 commented Jan 22, 2019

ok, and if it's installed and not loaded on centos, then what?

@skyvondave

This comment has been minimized.

Copy link

@skyvondave skyvondave commented May 21, 2020

-bash: !': event not found

@skyvondave

This comment has been minimized.

Copy link

@skyvondave skyvondave commented May 21, 2020

I had to run:

php -r 'echo (extension_loaded("xdebug") ? "xdebug up and running!" : "xdebug is not loaded!");'

@derdek

This comment has been minimized.

Copy link

@derdek derdek commented Sep 1, 2020

I had to run:

php -r 'echo (extension_loaded("xdebug") ? "xdebug up and running!" : "xdebug is not loaded!");'

remove ! from command, because terminal try load history by !

php -r "echo (extension_loaded('xdebug') ? 'xdebug up and running' : 'xdebug is not loaded');"

@dwickeroth

This comment has been minimized.

Copy link

@dwickeroth dwickeroth commented Sep 29, 2020

In my case xdebug worked when using the php command line interpreter, but not when using apache. The line 'sudo systemctl restart php-fpm' saved me there.
Thanx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.