Skip to content

Instantly share code, notes, and snippets.

@uabassguy
Created February 20, 2018 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uabassguy/f9b89fb18b6f3e3475e461758eab3d23 to your computer and use it in GitHub Desktop.
Save uabassguy/f9b89fb18b6f3e3475e461758eab3d23 to your computer and use it in GitHub Desktop.
Temporarily run php cli without xdebug
#!/bin/sh
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"
}
php_no_xdebug $@
@uabassguy
Copy link
Author

sudo vi /usr/bin/php_no_xdebug
paste contents
sudo chmod +x /usr/bin/php_no_xdebug

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