Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Last active March 20, 2024 14:43
  • Star 20 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joseluisq/d7586c9e5bd52012e0cf to your computer and use it in GitHub Desktop.
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!
@djwave28
Copy link

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
Copy link

treii28 commented Jan 22, 2019

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

@skyvondave
Copy link

-bash: !': event not found

@skyvondave
Copy link

I had to run:

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

@derdek
Copy link

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
Copy link

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