Skip to content

Instantly share code, notes, and snippets.

@marcandreappel
Last active December 9, 2023 01:16
Show Gist options
  • Save marcandreappel/4b0064947c87a20be3ad76eba94f34c6 to your computer and use it in GitHub Desktop.
Save marcandreappel/4b0064947c87a20be3ad76eba94f34c6 to your computer and use it in GitHub Desktop.
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