Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Xdebug on Valet with PHPStorm

Xdebug on Valet with PHPStorm

Installation

Install homebrew → https://brew.sh

Install beforehand NginX, MariaDB, DnsMasq and PHP7.2 with Composer

$ brew install php nginx mariadb dnsmasq composer

While at it, install CGR to isolate future problems with composer lobal require (see laravel/valet#199)

$ composer global require consolidation/cgr

From now on use cgr install namespace/package instead of composer global require!

Install valet → https://laravel.com/docs/master/valet#installation (but with cgr, remember)

Install Xdebug

$ (sudo) pecl install xdebug

Copy the path to the extension!

Configuration

PHP ► Xdebug

In /usr/local/etc/php/7.2/conf.d create a new file xdebug.ini with the following content:

[xdebug]
zend_extension=/usr/local/Cellar/php/7.2.x/pecl/20170718/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9000

PHPStorm

  • under PreferencesLanguages & FrameworksPHP update CLI Interpreter with /usr/local/bin/php.
  • in sub-module Debug update Xdebug by unchecking the two force break checkboxes (leave port to 9000).

Usage

Install https://github.com/BrianGilbert/xdebug-helper-for-firefox Xdebug helper for Firefox.

Activate listening in PHPStorm:

Debug listening activated

Happy debugging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.