From the error message, you can see that the text Apache doesn't like starts with "connect". The string you pass to 'die' is capitalized, so if the database connection failed, you'd see "Connect" in the error message.
So your database connection is fine. Your only problem at this point is, indeed, the HTTP headers.
y.paw.mrk.;;print chr 0x5b ;;;