In an earlier post I demonstrated how to install PHP5.4 using brew. Today, I required xdebug for debugging purposes and found it quite easy to install via homebrew.
Create an xdebug.ini file (must end by.ini ): # Navigate to the Devilbox git directory host cd path/to/devilbox # Navigate to PHP 5.6 ini configuration directory host cd cfg/php-ini-5.6/ # Create and open debug.ini file host vi xdebug.ini. When you save this, it should show PHP version: your version + Xdebug: 2.5.5. After this, save all settings and then click the phone icon (listen for debugging) on the PHPStorm debug toolbar. Then go to your site in Lando and click the Jetbrains Chrome extension to start debugging. PHPStorm will then connect with Chrome, but complain. Depending on your environment, you can debug your PHP Web application locally or remotely. To test direct connection, run the telnet host 9000 (for Xdebug) or the telnet host 10137 (for Zend Debugger) command on the remote server and ensure that connection is established. Here, host is the IP address of the local machine PhpStorm is running on. Sudo apt-get install -y php-xdebug Further configuration is done within the php extension. The extension file for xdebug is located at: /mods-available/xdebug.ini. To find out where is your php installation, you can run a quick ` php -i grep php.ini `.
Install XDebug for PHP
It’s as simple as issuing the command:
Phpstorm Xdebug Mac Free
zend_extension='/usr/local/Cellar/php54-xdebug/2.2.0/xdebug.so' |
Follow the output of the brew info output of the package you installed (either php53 or php54):
To enable remote debugging, I also added these lines:
Phpstorm Xdebug Mac Version
2 4 | xdebug.remote_port=9000 xdebug.remote_host='localhost' |
Debugging Web Applications
In the run configuration, add “Web Application” type. Configure the server and path as usual. When setup, you shall notice the debug button is active. Setup some break points and hit the debug button.
You can also use the “Listen PHP Debug Connection” option along with some xdebug bookmarklet for quick debugging.
Debugging Command Line Scripts
To debug command line scripts, first issue this command on terminal:
Phpstorm Xdebug Docker Cli
PS: I added the line to my ~/.bash_profile so that I don’t have to type it every time I login to bash shell.
Setup Xdebug Phpstorm Mac
Turn on incoming connections by clicking the “Start Listen PHP Debug Connection” button. Set some break points and then run the script from command line.