Search code examples
linuxcentosxdebugxdebug-3

PHP 8.0: How to apply xdebug.ini


I installed Xdebug 3.0 on CentOS, but I don't want to use it by modifying php.ini. I want to create a new xdebug.ini to load Xdebug.

How can I do this?

> php -v
PHP 8.0.6 (cli) (built: May 26 2021 16:08:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.6, Copyright (c) Zend Technologies

Solution

  • If you run php --ini | grep additional it will tell you a directory name, as in:

    derick@mezcal:~$ php --ini | grep additional
    Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
    

    You can then place an xdebug.ini file, preferably as 99-xdebug.ini into this directory with the Xdebug settings that you need.

    You can then verify whether this works, by running php --ini | grep xdebug, and it should list the file that you have created:

    derick@mezcal:~$ php --ini | grep xdebug
    /etc/php/7.0/cli/conf.d/99-xdebug.ini