Search code examples
phpphpunitphpstormxdebug

Failing to load Xdebug when running PHPUnit Tests


I have been having a option for a few days. When I try to run a PHPUnit test I get a message saying failed to load Xdebug. I have tried to reinstall, change filepaths etc but I am getting nowhere. Hoping somebody can help me out :)

PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

enter image description here


Solution

  • Failing loading xxxx.dll is an indication that PHP can't load the extension file. This could have several reasons:

    1. The file does not exist → check if it does

    2. The permissions on the file are incorrect → check the permissions

    3. The file is of "the wrong extension type". Which can be either:

      • the extension is for the wrong wrong PHP version
      • the extension is of the wrong bitness (32 vs 64bit)
      • the wrong TS variant (NTS vs ZTS)
      • the wrong "debug mode" build of PHP (either debug, or nodebug)

    The API type (except for bitness, which you can check with echo PHP_INT_SIZE;; 4 is 32bit, and 8 is 64bit) is reflected in the "Zend Extension Build" output in php -i or phpinfo().

    You can use Xdebug's wizard to tell you which exact file to download for your specific set-up.