Have noticed on debian now, and may be true of other builds, that if you are using php as a command line language, you don't need the -q ie: #!/usr/bin/php -q anymore.
What really took me ages to work out was how to the use php in cgi mode (ie in a cgi-bin directory) as it doesn't send http headers by default. It also fails to populate $_GET and $_POST arrays.
Turns out debian php build comes with /usr/bin/php-cgi
Use this in your shebang if running CGI scripts!
I understand now - but had to figure this out myself!
Keywords I tried to solve this problem with were:
PHP, CGI, no $_GET array, Premature end of script headers, No http Headers, debian
Hopefully this post might save someone many hours of frustration, if they are googling the above words!