Table of Contents

PHP HTTP Response Handling Summary

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.

HTTP Response Content

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)

Session Handling Functions provide the capability to use url based session Ids in the content output.

The Zlib Compression Functions can compress output on-the-fly.

Zlib compression configuration options:

HTTP Response Headers

Basic HTTP Functions.

Output compression configuration

Several configuration options control how the php session handling functions output cookies for tracking sessions.

functions controling how cookies are output during session handling.

Configuration options controlling page caching during a session:

Functions controlling page caching during a session:

Apache specific functions configuration options

HTTP Response Status

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.

Web Server Interface

Apache specific functions for response processing

HTTP Response Header / PHP Cross Reference

Content-Encoding

The zlib.output_compression configuration option or ob_gzhandler output handler can output Content-Encoding: gzip or Content-Encoding: deflate headers.

Content-Length

The zlib.output_compression configuration option or ob_gzhandler output handler can output Content-Length headers.

Content-Type

The mb_output_handler function and the configuration option mbstring.http_output can add charset information to the Content-Type headers.

Last-Modified

The last_modified configuration option send PHP scripts modification date as Last-Modified: header for the request. See Apache specific functions.

Set-Cookie

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.

Vary

The zlib.output_compression configuration option or ob_gzhandler output handler can output Vary: Accept-Encoding headers.