I’m adding the following:
<?php ob_start( 'ob_gzhandler' ); ?>
To a file to enable gzip compression.
Should it go before the DTD, or between it and the <html> tag?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It has to go before the DTD and any other output. The
<of<?phpmust be the absolute first byte of the file otherwise there is literal output before it (even if that’s only whitespace, or a UTF-8 fake-BOM emitted by a misguided Windows text editor).Any
<!DOCTYPE>declaration in a .php file is just pure output text, something that applies to the returned HTML page and not the PHP file itself (as PHP is neither HTML nor XML).