See HttpServletResponse for more information on how Java handles HTTP Responses.
See PHP HTTP Request Handling Summary for more information on how PHP handles HTTP requests.
PHP has a fairly simple output mechanism compared to Java Servlets.
The Output Control Functions provide control over the buffering of the content output of the request. They also provide a simple mechanism to stack output filters. See InterceptingFilter.
output buffer configuration settings (ini)
output_buffering - enable buffering for all requestsoutput_handler - Register an output handling function. Same as ob_start.implicit_flush - flush output after every output block (echo, print or printf)Session Handling Functions provide the capability to use url based session Ids in the content output.
session.use_trans_sid - when this option is enabled, relative URIs in the response output will be rewritten to contain a session Id.url_rewriter.tags - specifies which html tags are rewritten to include session information.The Zlib Compression Functions can compress output on-the-fly.
Zlib compression configuration options:
zlib.output_compression - Whether to transparently compress pageszlib.output_compression_level - Compression level used for transparent output compressionzlib.output_handler - similiar to output_handlerBasic HTTP Functions.
Output compression configuration
zlib.output_compression - outputs Content-Encoding and Vary headers when content is compressed.Several configuration options control how the php session handling functions output cookies for tracking sessions.
session.auto_start - specifies whether the session module starts a session automaticallysession.name - Used as the cookie namesession.cookie_lifetime - How long should the browser store the cookiesession.cookie_pathsession.cookie_domainsession.cookie_securesession.use_cookies - specifies whether the module will use cookies to store the session id on the client sidesession.use_only_cookies - specifies whether the module will only use cookies to store the session id on the client sidefunctions controling how cookies are output during session handling.
Configuration options controlling page caching during a session:
session.cache_limiter - specifies cache control method to use for session pagesession.cache_expire - specifies time-to-live for cached session pagesFunctions controlling page caching during a session:
Apache specific functions configuration options
last_modified - send PHP scripts modification date as Last-Modified: header for the request.The header function has special case logic to also set the response status code. When the header paramter to the header() function begins with HTTP/, Status:, or Location:, the HTTP response status code is modified.
See HTTP authentication with PHP for more information about setting the response status.
Apache specific functions for response processing
The zlib.output_compression configuration option or ob_gzhandler output handler can output Content-Encoding: gzip or Content-Encoding: deflate headers.
The zlib.output_compression configuration option or ob_gzhandler output handler can output Content-Length headers.
The mb_output_handler function and the configuration option mbstring.http_output can add charset information to the Content-Type headers.
The last_modified configuration option send PHP scripts modification date as Last-Modified: header for the request. See Apache specific functions.
The setcookie function is the standard API for developers to output this header. PHP Session Handling Functions Will also set a cookie for tracking session Ids.
The zlib.output_compression configuration option or ob_gzhandler output handler can output Vary: Accept-Encoding headers.