- Homebrew Xdebug Pro
- Homebrew Xdebug Hack
- Homebrew Install Xdebug Php 7.2
- Homebrew Xdebug Mac
- Homebrew Xdebug
- Homebrew Xdebug Free
This section describes on how to install Xdebug.
- You can install Xdebug through PECL on Linux & macOS with Homebrew.
- Dumb question I think, but I have PHP 5.6.14 running on El Capitan. I have installed xdebug with brew install php56-xdebug But there is no mention of xdebug in phpinfo phpinfo reveals: Configu.
Xdebug is an extension for PHP, and provides a range of features to improve the PHP development experience.
Installing with PECL
You can install Xdebug through PECL on Linux & macOS with Homebrew.Run:
Warning: You should ignore any prompts to add'extension=xdebug.so'
tophp.ini
— this will cause problems.
In some cases pecl
will change the php.ini
file toadd a configuration line to load Xdebug. You can check whether it did byrunning php -v
. If Xdebug shows up with a version number, thanyou're all set and you can configure Xdebug's other functions, such asStep Debugging, or Profiling.
If pecl
did not add the right line, skip to the Configure PHP section.
1 On macOS, you should have PHP installed with Homebrew.
Installing on Windows
There are a few precompiled modules for Windows, they are all for the non-debugversion of PHP. You can get those at the downloadpage. Follow these instructions to get Xdebuginstalled.
Installation From Source
Warning: This information is outdated.Xdebug 2 is no longer supported.
Obtain
You can download the source of the latest stable release 2.9.8.
Alternatively you can obtain Xdebug from GIT:
This will checkout the latest development version which is currently2.9.8. This development branch might not always work asexpected, and may have bugs.
You can also browse the source on GitHub at https://github.com/xdebug/xdebug.
Compile
Homebrew Xdebug Pro
There is a wizard available that provides youwith the correct file to download, and which paths to use.
You compile Xdebug separately from the rest of PHP. You need access to thescripts phpize
and php-config
. If your systemdoes not have phpize
and php-config
, you willneed to install the PHP development headers.
Debian users can do that with:
And RedHat and Fedora users with:
Homebrew Xdebug Hack
It is important that the source version matches the installed version as thereare slight, but important, differences between PHP versions. Once you haveaccess to phpize
and php-config
, take thefollowing steps:
Unpack the tarball:
tar -xzf xdebug-2.9.8.tgz
You should notunpack the tarball inside the PHP source code tree.Xdebug is compiled separately, all by itself, as stated above.
cd xdebug-2.9.8
phpize
If phpize is not in your path, please make surethat it is by expanding the
PATH
environment variable. Make sureyou use the phpize that belongs to the PHP version that you want to use Xdebugwith. See this FAQ entry if you're having someissues with finding which phpize to use../configure --enable-xdebug
make
make install
Configure PHP
Add the following line to
php.ini
:zend_extension=/wherever/you/put/it/xdebug
To find out which
php.ini
file to modify, run a script with thefollowing:Alternatively, you can run
php --ini
on the command line.Note: There could be more than one
php.ini
file. In many set-ups there is a different one for thecommand line (oftencli/php.ini
) and the web server (oftenfpm/php.ini
).Note: If you want to use Xdebug andOPCache together, you must have the
zend_extension
line for Xdebugbelow the line for OPCache. Otherwise, they won't work properly together.Restart your webserver, or PHP-FPM, depending on what you areusing.
Verify that Xdebug is now loaded.
Create a PHP page that calls phpinfo(). If you request thepage through the browser, it should show you an overview of Xdebug's settingsand log messages.
On the command line, you can also run
php -v
. Xdebug and itsversion number should be present as in:
With Xdebug loaded, you can now enable individual features, such asStep Debugging, or Profiling.
Question or issue on macOS:
Homebrew Install Xdebug Php 7.2
The homebrew/php tap was recently deprecated. This deprecation included versioned formulae for php installations (e.g., php56) as well as installation of individual extensions (e.g., php56-xdebug).
Installing PHP 5.6 with Homebrew now requires the command: brew install [email protected]
Installing PHP 5.6 and then running phpinfo() indicates that Xdebug is not loaded in the list of extensions, and a debugger extension is not found. A selective copy of the output is as follows:
Homebrew Xdebug Mac
Running brew options php and brew options [email protected] yield no information on options to install additional extensions in the homebrew installation process. brew search xdebug yields no packages of interest.
As far as I can tell, Xdebug is not installed by default, and there is currently no mechanism to install Xdebug using homebrew with this new generic php formula.
Does anybody know how to go about installing Xdebug in a sensible way now that the original homebrew/php tap has been deprecated?
Homebrew Xdebug
How to solve this problem?
Solution no. 1:
According to this answer, you can install it with pecl install xdebug
. However, newer versions of xdebug have dropped support for PHP 5.6. To install an older version of xdebug with support for php 5.6, use pecl install xdebug-2.5.5
Solution no. 2:
I’ve found a solution to use the deprecated homebrew/php to install php56-extensions.
Homebrew Xdebug Free
I hope I’ve helped you