Skip to content

Instantly share code, notes, and snippets.

@bkdotcom
Created March 28, 2018 15:10
Show Gist options
  • Save bkdotcom/4b635f7c7c07dd5800dee89cdb99e4f6 to your computer and use it in GitHub Desktop.
Save bkdotcom/4b635f7c7c07dd5800dee89cdb99e4f6 to your computer and use it in GitHub Desktop.
run php with xdebug dissabled
# add this function / alias to your .bash_profile
# call php_no_xdebug from command line just as you would call php from the command line
# this will call php with xdebug dissabled
php_no_xdebug () {
temporaryPath="$(mktemp -t php.XXXX).ini"
# Using awk to ensure that files ending without newlines do not lead to configuration error
php -i | grep "\.ini" | grep -o -e '\(/[a-z0-9._-]\+\)\+\.ini' | grep -v xdebug | xargs awk 'FNR==1{print ""}1' > "$temporaryPath"
php -n -c "$temporaryPath" "$@"
rm -f "$temporaryPath"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment