• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Deeper Scenery

Further up and further in

  • Home
  • Blog
  • Code
  • Tutorials
  • Privacy Policy
You are here: Home / Ideas / Installing Xdebug for older PHP versions with Valet

Ideas · Published: October 27, 2023 · Modified: October 27, 2023

Installing Xdebug for older PHP versions with Valet

This is just a small idea. For more information, see this blog post.

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

Filed Under: Ideas

Previous Post: « Renaming a Valet+ Site

Primary Sidebar

Subscribe to jeremypry.com

Enter your email address to subscribe to this site and receive notifications of new posts by email.

  • Home
  • Blog
  • Code
  • Ideas
  • Tutorial
  • Gifts
  • Privacy Policy

Copyright © 2025 · JPry Showcase Pro on Genesis Framework · WordPress · Log in