Skip to content

Instantly share code, notes, and snippets.

@Great-Antique
Created December 2, 2019 09:53
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 Great-Antique/950b998ccdfbb5b52398c658638aa5ac to your computer and use it in GitHub Desktop.
Save Great-Antique/950b998ccdfbb5b52398c658638aa5ac to your computer and use it in GitHub Desktop.
PHP without Xdebug
#!/usr/bin/env sh
temporaryPath="$(mktemp -t php.XXXXXXXXXX).ini"
# Using awk to ensure that files ending without newlines do not lead to configuration error
php -i \
| grep "\.ini" \
| grep -v COMPOSER_ORIGINAL_INIS \
| grep -v XDEBUG_HANDLER_SETTINGS \
| grep -o -e '\(/[a-z0-9._-]\+\)\+\.ini' \
| grep -v xdebug \
| xargs awk 'FNR==1{print ""}1' > "$temporaryPath"
echo "Temporary php.ini path: $temporaryPath"
/usr/bin/env php -n -c "$temporaryPath" "$@"
tempExitCode="$?"
rm -f "$temporaryPath"
exit $tempExitCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment