Search code examples
phpstormxdebugphp-7.4

How to install Xdebug on PhpStorm Apache 2 PHP 7.4


I've installed Xdebug and setup by this instruction:

Install Xdebug PHP:

sudo apt-get update -y
sudo apt-get install -y php7.4-xdebug

Find xdebug.so, then add the first one to php.ini:

sudo updatedb
locate xdebug.so

enter image description here

locate php.ini

enter image description here

Config php.ini:

sudo gedit /etc/php/7.4/apache2/php.ini

enter image description here

Then restart Apache web server:

sudo service apache2 restart

PhpStorm settings and code:

enter image description here enter image description here

Result and Xdebug Chrome extension enabled:

enter image description here

Did I miss anything? This setting works fine for me in PHP 7.2 and bellow but now on PHP 7.4 and it's not working any more.


Solution

  • For PHP 7.4 you need xdebug.so with 20190902 in the path.

    You can check that from phpinfo() output: and you will see the PHP API version there, at the very top:

    PHP 7.4:

    ...
    PHP API => 20190902
    PHP Extension => 20190902
    Zend Extension => 320190902
    ...
    

    PHP 7.2:

    ...
    PHP API => 20170718
    PHP Extension => 20170718
    Zend Extension => 320170718
    ...
    

    Your 20131226 is for PHP 5.6.

    You have to use extensions that were compiled to use the same API version.

    So double check phpinfo() output: you need to confirm that right API version is used + that Xdebug is actually loaded and enabled (use xdebug_info() for Xdebug v3; for Xdebug v2 you will have to check dedicated Xdebug section from phpinfo() output).