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.
Came across this in a google search, just an FYI that repository no longer exists. Here's a quick list of them though: https://pkgs.alpinelinux.org/packages?name=php7-xdebug&branch=&repo=&arch=&maintainer=