Skip to content

Instantly share code, notes, and snippets.

@jeffersonsouza
Forked from crittermike/xdebug_alpine.md
Created May 3, 2017 18:21
Show Gist options
  • Save jeffersonsouza/dede493c13100522319b26d5eec20b72 to your computer and use it in GitHub Desktop.
Save jeffersonsouza/dede493c13100522319b26d5eec20b72 to your computer and use it in GitHub Desktop.
Xdebug + PHPStorm for PHP 7 on Alpine Linux

First, install the Xdebug package from the testing repository.

$ apk add php7-xdebug --repository http://dl-3.alpinelinux.org/alpine/edge/testing/

Now edit the /etc/php7/php.ini file and add the following to the end of it:

zend_extension=/usr/lib/php7/modules/xdebug.so
xdebug.coverage_enable=0 
xdebug.remote_enable=1      
xdebug.remote_connect_back=1
xdebug.remote_log=/tmp/xdebug.log
xdebug.remote_autostart=true  

With everything in place, we're ready to restart the server.

$ nginx -s reload
$ /etc/init.d/php-fpm restart

At this point, in PHPStorm, click "Run > Start Listening for PHP Debug Connections", and then "Run > Break at first line in PHP Scripts".

Now reload the site in the browser, making sure to use the port that goes directly to the server, which is sometimes :8080 instead of :80, and you should see the debugger fire up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment