This tutorial explains how to install Xdebug extension to your web server and prepare it to be used for debugging with PhpStorm IDE.
HomeBrew is a package manage for OS X that helps you to easily install commonly used packages. HomeBrew can be used to install and upgrade your version of PHP, and can also be used to easily install Xdebug:
brew install php<version number>-xdebug
Where <version number> is the version number (without the .) that you are using. For example, for PHP 5.6 use:
brew install php56-xdebug
This will install and enable Xdebug in your php.ini file. You can check that Xdebug has been install by using the command
You should see a line similar to
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Add the following lines at the end of your php.ini file:
[Xdebug] zend_extension=<full_path_to_xdebug_extension> xdebug.remote_enable=1 xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)> xdebug.remote_port=<the port to which Xdebug tries to connect on the host where PhpStorm is running (default 9000)>
Since PHP 5.3, you always need to use the 'zend_extension', and NOT 'zend_extension_ts', 'zend_extension_debug' or 'extension'.
The value of 'xdebug.remote_host' can be a host name (e.g. localhost) or an IP address.
The value of 'xdebug.remote_port' is usually 9000. It is default value in Xdebug and PhpStorm. Ensure that the specified port is opened on your client machine.
For additional information check http://xdebug.org/docs/remote
Execute in the terminal
Or create a file with the following content: