Last active
July 13, 2018 07:59
-
-
Save mikemix/df1f3ecbc93ee2b725e9c186309f7c06 to your computer and use it in GitHub Desktop.
Shell script wrapper for debugging Symfony console applications with XDebug and Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
## | |
# Fill this accordingly! | |
# The "server" has to be configured in phpStorm (Settings > Language & Frameworks > PHP > Servers). | |
# Put the name inside the quotes | |
phpstorm_server_name="localhost" | |
## | |
# Put me in bin/ alongside the console script | |
# Example usage in the container: bin/console-debug app:your_command | |
# Example usage outside the container: docker-compose exec container_name bin/console-debug app:your_command | |
# | |
# Is your bin/console script popping up upon execution? | |
# In phpStorm (Language & Frameworks > PHP > Debug) uncheck both: | |
# - Force break at first line when a script is outside the project | |
# - Break at first line in PHP scripts | |
## | |
host_ip=`/sbin/ip route|awk '/default/ { print $3 }'` | |
export PHP_IDE_CONFIG="serverName=$phpstorm_server_name" | |
php -dxdebug.remote_host=$host_ip -dxdebug.remote_start=1 bin/console "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment