Using Laravel Valet for local development with PHP 7.4, I needed to install Xdebug. In the past, I was able to run pecl install xdebug
, but this time I was met with an error:
pecl install xdebug
pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.33
No valid packages found
install failed
Other package managers allow specifying a version to install, so after determining which version of Xdebug I could use, I tried this:
pecl install [email protected]
parsePackageName(): invalid package name "[email protected]" in "[email protected]"
invalid package name/package file "[email protected]"
install failed
I ran pecl help install
to determine the correct syntax, and found that it should look like this instead:
pecl install xdebug-3.1
Failed to download pecl/xdebug, version "3.1", latest release is version 3.3.0alpha3, stability "beta", use "channel://pecl.php.net/xdebug-3.3.0alpha3" to install
install failed
Unlike other package installers, this one needed a full version number instead of the major and minor only. I found the latest published version on the PECL Xdebug page, which finally lead to the correct command:
pecl install xdebug-3.1.5
downloading xdebug-3.1.5.tgz ...
Starting to download xdebug-3.1.5.tgz (232,070 bytes)
.................................................done: 232,070 bytes
// ... lots of lines of the build process
+----------------------------------------------------------------------+
| |
| INSTALLATION INSTRUCTIONS |
| ========================= |
| |
| See https://xdebug.org/install.php#configure-php for instructions |
| on how to enable Xdebug for PHP. |
| |
| Documentation is available online as well: |
| - A list of all settings: https://xdebug.org/docs-settings.php |
| - A list of all functions: https://xdebug.org/docs-functions.php |
| - Profiling instructions: https://xdebug.org/docs-profiling2.php |
| - Remote debugging: https://xdebug.org/docs-debugger.php |
| |
| |
| NOTE: Please disregard the message |
| You should add "extension=xdebug.so" to php.ini |
| that is emitted by the PECL installer. This does not work for |
| Xdebug. |
| |
+----------------------------------------------------------------------+
// ... tmp file processing
Build process completed successfully
Installing '/opt/homebrew/Cellar/[email protected]/7.4.33_4/pecl/20190902/xdebug.so'
install ok: channel://pecl.php.net/xdebug-3.1.5
Extension xdebug enabled in php.ini