Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created November 19, 2012 21:11
Show Gist options
  • Save michaeltwofish/4113926 to your computer and use it in GitHub Desktop.
Save michaeltwofish/4113926 to your computer and use it in GitHub Desktop.
Last php error
lasterror () {
logpath=/usr/local/www-conf/logs/$1-phplog
error=(${(f)$(awk -F: '/PHP Fatal error|\[error\]/ { lines[last] = NR } END { print lines[last] }' $logpath)})
[[ -n $error ]] && tail -n +$error $logpath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment