Remove shebang from PHAR build
Fixed issues with error handling and ensured that HTTP error handling occurs as soon as possible.