: This article mainly introduces the http status code output by PHP and common status codes. if you are interested in the PHP Tutorial, refer to it.
header("HTTP/1.1 403 Forbidden");echo <<
Error 404 Not Found Not Found
That’s an error.
The requested URL
was not found on this server. That’s all we know.
404 Not Found Not Found The requested URL
was not found on this server.
Web Server at {$_SERVER["SERVER_NAME"]} Port {$_SERVER["SERVER_PORT"]} sql;
Http://www.w3.org/Protocols/rfc2616/rfc2616
Hypertext Transfer Protocol -- HTTP/1.1
Http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
100-199 is used to specify the actions corresponding to the client.
200-299 indicates that the request is successfully understood and accepted.
300-399 is used for moved files and is often included in the positioning header to specify the new address information.
400-499 is used to indicate client errors.
500-599 is used to support server errors.
[Informational 1xx] informatization
100 = "Continue": if the server receives a request with a header containing 100-continue, this indicates whether the client can send attachments in subsequent requests. In this case, the server uses 100 (SC _CONTINUE) to allow the client to continue or uses 417 (Expectation Failed) to tell the client not to agree to accept the attachment. This status code is newly added in HTTP 1.1.
101 = "Switching Protocols" exchange protocol: the server understands and is willing to follow the customer's requirements. by upgrading the message header field, change the application protocol used for this connection.
[Successful 2xx] Successful
>>> 200 = "OK" succeeded
201 = "Created": The request has been completed, resulting in the creation of a new resource. The URL of the positioning header should be provided.
202 = "Accepted" accept: the processing request has been Accepted, but the processing has not been completed.
203 = "Non-Authoritative Information" unauthorized Information
>>> 204 = "No Content": The server has completed the request, but No Content is returned.
205 = "Reset Content" Reset Content: The server has completed the request and the user agent should Reset the document view that caused the request to force the browser to clear the form field. This is newly added in HTTP 1.1.
206 = "Partial Content" part of Content:
[Redirection 3xx] Redirection
300 = "Multiple Choices" Multiple options: indicates that the requested document can be found in Multiple places and listed in the returned document. If the server has a preferred setting, the preferences will be listed in the positioning response header information.
>>> 301 = "Moved Permanently" permanent movement: the requested resource is assigned a new permanent URI and any future reference of this resource should use the returned URI, the browser automatically connects to the new URL. Note: When a POST request is automatically redirected to receive a 301 status code, some existing HTTP/1.0 User proxies mistakenly change to a GET request.
>>> 302 = "Found" Found: requested resources temporarily reside in a temporary URI. Similar to 301, only the URL given in the positioning header information should be understood as a temporary exchange address rather than permanent. Note: In HTTP 1.0, messages are Temporarily Moved (Moved Temporarily), not discovered
303 = "See Other" view others: the response to this request can be retrieved in a different URI and the GET method of this resource should be used. Similar to 301 and 302, but if the initial request is POST, the new document (given in the positioning header) should be retrieved with GET. This status code is newly added to HTTP 1.1.
>>> 304 = "Not Modified": the server should respond to this status code if the client is allowed to access the GET request but the file is Not Modified.
305 = "Use Proxy": the location field of the requested resource must be accessed through the Proxy. Added to HTTP 1.1.
306 = "(Unused)" (not used) 306 status code uses the previous version of the specification, no longer used, the code is retained
307 = "Temporary Redirect" Temporary redirection: the requested resource temporarily resides in a different URI. The rule that the browser uses to process the 307 status is the same as that in the 302 status. The 307 status is added to HTTP 1.1 because many browsers still perform an incorrect redirection even if the original message is POST when they receive the 302 response. It is assumed that the browser will redirect the POST request only when the 303 response is received. The purpose of adding this new status code is clear: when the response is 303, the request is redirected according to the GET and POST requests; when the response is 307, the request is redirected according to the GET request instead of the POST request.
[Client Error 4xx] Client Error
>>> 400 = "Bad Request" the server does not understand the Request syntax.
>>> 401 = "Unauthorized" Unauthorized: The request requires user authentication. if the request already contains an authorization certificate, the 401 response indicates that the request has been rejected as a credential. This response must contain a WWW-Authenticate authorization information header.
402 = "Payment Required" Payment Required: this code is retained for future use.
>>> 403 = "Forbidden" Forbidden: The server rejects the request.
> 404 = "Not Found" Not Found
405 = "Method Not Allowed": the Method specified in the request line is the resource identified by the request URI that is Not Allowed. Indicates that the request method (GET, POST, HEAD, PUT, DELETE, and so on) is not allowed to use certain resources.
406 = "Not Acceptable" unacceptable: indicates that the MIME type of the requested resource is different from the type specified in the Accept header in the client.
407 = "Proxy Authentication Required" Proxy server Authentication: this code is similar to 401 (unauthorized), but indicates that the client must first authenticate it.
408 = "Request Timeout" Request Timeout: the client does not generate a Request during the waiting time of the server. Added to HTTP 1.1.
409 = "Conflict" Conflict: the request cannot be completed because of a Conflict with the current status of the resource. This status is usually used together with the PUT request, and the 409 status is often used to try to upload files with incorrect versions. This status code is newly added to HTTP 1.1.
>>> 410 = "Gone": the requested resource is no longer an available server or a forwarding address. Tell the client that the requested document does not exist and there is no updated address. The 410 status is different from the 404,410 status when the guidance document has been removed, and 404 is used for inaccessible for unknown reasons. This status code is newly added to HTTP 1.1.
411 = "Length Required" Length Required: the server rejects the request and does not define the content Length. Indicates that the server cannot process the request (assuming a POST request with an attachment), unless the client sends the Content-Length header to indicate the size of the data sent to the server. This status is newly added to HTTP 1.1.
412 = "Precondition Failed" Precondition Failed: when one or more Request Header fields are tested on the server, the Precondition is given in one or more request header fields. It indicates that some of the prerequisites in the request header information are incorrect. This status is newly added to HTTP 1.1.
413 = "Request Entity Too Large" Request Entity is Too Large: tell the client that the requested document is larger than what the server wants to process now. If the server determines that it can be processed for a period of time, it will contain a Retry-After response header. This status is newly added to HTTP 1.1.
414 = "Request-URI Too Long" The Request URI is Too Long: the status is used when the URI is Too Long. The "URI" here refers to the host, domain name, and port number in the URL. Added HTTP 1.1.
415 = "Unsupported Media Type" does not support the Media Type: the server does not know how to handle the format Type of the attachment contained in the request. This status is newly added to HTTP 1.1.
416 = "Requested Range Not Satisfiable" The request Range does Not match: indicates that the client contains a request with the Range header information that the server cannot satisfy. This status is newly added to HTTP 1.1.
417 = "Expectation Failed" expected failure: if the server receives an audit Ct request header with a 100-continue value, the client is asking whether attachments can be sent in subsequent requests. In this case, the server also uses this status (417) to tell the browser that the server does not receive the attachment or that the client can continue sending the attachment in the 100 status. This status is newly added to HTTP 1.1.
[Server Error 5xx] Server Error
> 500 = "Internal Server Error" Internal Server Error
>>> 501 = "Not Implemented" cannot be executed: the server does Not support the functions required to complete the request. Tell the client server that it does not support the features required in the request. For example, the client executes commands that are not supported by a server such as PUT.
>>> 502 = "Bad Gateway" error Gateway: The server acts as a Gateway or proxy and receives an invalid response from the upstream server in an attempt to satisfy the access request. This status indicates that the receiving server receives an error response from the remote server.
>>> 503 = "Service Unavailable" Service Unavailable: The server cannot process requests due to temporary overload or server maintenance. Some servers may want to simply reject the connection. For example, if some threads or database connection pools are not idle, the server should return this header information. The server provides a Retry-After header to tell the client when to try again.
504 = "Gateway Timeout" Gateway Timeout: it indicates that the receiving server does not receive a timely response from the remote server. This status is newly added to HTTP 1.1.
505 = "HTTP Version Not Supported" HTTP Version is Not Supported: the server does Not support or rejects the Supported HTTP Version, which is used in the request message. This status is newly added to HTTP 1.1.
Simplified version:
2XX succeeded in processing the request status code.
200 The server has successfully processed the request and provided the requested webpage.
204 The server successfully processed the request but did not return any content.
Redirect 3XX: the number of redirection requests must not exceed 5.
301 the requested webpage has been permanently moved to a new location. Code 301 is used when the URLs changes. Save the new URL in the search engine index.
302 The requested webpage is temporarily moved to a new location. The original URL is saved in the search engine index.
304 if the web page is not updated after the last request, use code 304 to notify the search engine robot, which can save bandwidth and costs.
Client Error 4XX indicates that the request may fail, which hinders server processing.
400 the server does not understand the request syntax.
403 the server rejects the request.
404 the server cannot find the requested webpage. This code is often returned for webpages that do not exist on the server.
410 after the requested resource is permanently deleted, the server returns this response. This code is similar to the 404 (not found) code,
However, when a resource exists before and does not exist, it is sometimes used to replace code 404. If the resource has been permanently deleted, use 301 to specify a new location for the resource.
Server error 5XX indicates that the server encountered an internal error when processing the request. These errors may be server errors rather than request errors.
500 the server encountered an error and could not complete the request.
503 the server is currently unavailable (due to overload or downtime maintenance ). Generally, this is only a temporary status.
Detailed breakdown:
2XX successful
200 normal; the request has been completed.
201 normal; followed by the POST command.
202 normal; accepted for processing, but not completed.
203 normal; partial information-only part of the returned information.
204 normal; no response-received request, but no information to send back.
3XX Redirection
301 Moved-the requested data has a new location and the change is permanent.
302 Found-the requested data temporarily has different URIs.
303 refer to others-you can find the response to the request under another URI and use the GET method to retrieve the response.
304 not modified-the document was not modified as expected.
305 use proxy-the requested resource must be accessed through the proxy provided in the location field.
306 not used-no longer used; keep this code for future use.
Errors in 4XX Client
400 error request-the request has a syntax problem or cannot meet the request.
401 Unauthorized-unauthorized client access to data.
402 Payment required-the billing system is in effect.
403 Forbidden-access is not required even if authorized.
404 Not Found-the server cannot find the specified resource; the document does not exist.
407 Proxy Authentication request-the client must first use proxy authentication itself.
415 the media type is not supported-the server rejects service requests because the request entity format is not supported.
5XX Server error
500 internal error-the server cannot complete the request due to exceptions.
501 not executed-the server does not support the requested tool.
502 error gateway-the server receives an invalid response from the upstream server.
503 unable to obtain services-the server cannot process requests due to temporary overload or maintenance.
504 Gateway Timeout
When a server that works as a gateway or proxy attempts to execute a request, it fails to promptly access the upstream server (the server identified by the URI, such as HTTP, FTP, LDAP) or the secondary server (such as DNS) receive the response.
Note: Some proxy servers will return error 400 or 500 when DNS query times out.
505 HTTP Version Not Supported
The server does not support or rejects the HTTP version used in the request. This implies that the server cannot or does not want to use the same version as the client. The response should contain an entity that describes why the version is not supported and what protocols the server supports.
506 Variant Also Negotiates
Extended by transparent content negotiation protocol (RFC 2295), it indicates that the server has an internal configuration error: The requested negotiated variable resource is configured to be used in transparent content negotiation, therefore, it is not a proper focus in a negotiation process.
507 Insufficient Storage
The server cannot store the content required to complete the request. This situation is considered temporary. WebDAV (RFC 4918)
508 Loop Detected
The server finds an infinite loop in the request.
509 Bandwidth Limit Exceeded
The server reaches the bandwidth limit. This is not an official status code, but it is still widely used.
510 Not Extended
The policies required for obtaining resources are not met. (RFC 2774)
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the PHP output http status code and common status codes, including the content, hope to be helpful to friends who are interested in PHP tutorials.