You want to enable compression in the PHP code output. Which of the following ways should you prefer most?
Set zlib.output_compression to on.
Correct:
Set zlib.output_compression to on.
Explanation: Answer option C is correct.
A user can compress the output of the PHP code in two ways, which are as follows:
By using the ob_start() function: The ob_start() function enables the compression in PHP output. Placing this function at the top of a page invokes PHP's output buffering mechanism, and causes it to transparently compress the script's output.
By setting zlib.output_compression to on in PHP.ini file: A user can set zlib.output_compression to on to enable the output compression for always. This approach is the best approach since these settings can be turned on and off without affecting the code.
Answer options A and B are incorrect. These are not valid options.