{"id":228,"date":"2016-07-28T05:52:12","date_gmt":"2016-07-28T05:52:12","guid":{"rendered":"https:\/\/barkhane.com\/php\/2016\/07\/28\/what-is-server-request-in-php\/"},"modified":"2024-03-03T15:02:30","modified_gmt":"2024-03-03T15:02:30","slug":"what-is-server-request-in-php","status":"publish","type":"post","link":"https:\/\/barkhane.com\/php\/what-is-server-request-in-php\/","title":{"rendered":"$_SERVER in PHP"},"content":{"rendered":"<h2>What is $_SERVER in PHP<\/h2>\n<p>$_SERVER is <a href=\"https:\/\/barkhane.com\/php\/super-global-variable-in-php\/\" target=\"_blank\" rel=\"noopener\">global <\/a>variable \u00a0in PHP ,an array containing information such as headers, paths, and script locations in <a href=\"https:\/\/barkhane.com\/php\/what-is-php\/\" target=\"_blank\" rel=\"noopener\">PHP<\/a>. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these.<\/p>\n<p>Syntax : $variable\u00a0= $_SERVER[\\&#8217;Request type\\&#8217;];<\/p>\n<p>$_SERVER contain various\u00a0 important elements which request different details of\u00a0the page .<\/p>\n<table class=\"w3-table-all notranslate\">\n<tbody>\n<tr>\n<th>Type Of Server Request<\/th>\n<th>Request \u00a0Details<\/th>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;PHP_SELF\\&#8217;]<\/td>\n<td>Gives\u00a0filename of the currently executing script<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;GATEWAY_INTERFACE\\&#8217;]<\/td>\n<td>Gives version of the Common Gateway Interface (CGI) the server is using<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_ADDR\\&#8217;]<\/td>\n<td>Gives IP address of the host server<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_NAME\\&#8217;]<\/td>\n<td>Gives name of the host server (such as www.sitee.in)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_SOFTWARE\\&#8217;]<\/td>\n<td>Gives server identification string (such as Apache)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_PROTOCOL\\&#8217;]<\/td>\n<td>Gives name and revision of the information protocol (such as HTTP\/1.7)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;REQUEST_METHOD\\&#8217;]<\/td>\n<td>Gives request method used to access the page (such as GET)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;REQUEST_TIME\\&#8217;]<\/td>\n<td>Gives timestamp of the start of the request (such as 1478526369)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;QUERY_STRING\\&#8217;]<\/td>\n<td>Gives query string if the page is accessed via a query string<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;HTTP_ACCEPT\\&#8217;]<\/td>\n<td>Gives Accept header from the current request<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;HTTP_ACCEPT_CHARSET\\&#8217;]<\/td>\n<td>Gives Accept_Charset header from the current request (such as utf-8)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;HTTP_HOST\\&#8217;]<\/td>\n<td>Gives Host header from the current request<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;HTTP_REFERER\\&#8217;]<\/td>\n<td>Gives complete URL of the current page (not reliable because not all user-agents support it)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;HTTPS\\&#8217;]<\/td>\n<td>Is script queried through a secure HTTP protocol<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;REMOTE_ADDR\\&#8217;]<\/td>\n<td>Gives IP address from where the user is viewing the current page<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;REMOTE_HOST\\&#8217;]<\/td>\n<td>Gives Host name from where the user is viewing the current page<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;REMOTE_PORT\\&#8217;]<\/td>\n<td>Gives port being used on the user\\&#8217;s machine to communicate with the web server<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SCRIPT_FILENAME\\&#8217;]<\/td>\n<td>Gives absolute path name of the currently executing script<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_ADMIN\\&#8217;]<\/td>\n<td>Gives value given to the SERVER_ADMIN directive in the web server configuration file (if your script runs on a virtual host, it will be the value defined for that virtual host)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_PORT\\&#8217;]<\/td>\n<td>Gives port on the server machine being used by the web server for communication (such as 40)<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SERVER_SIGNATURE\\&#8217;]<\/td>\n<td>Gives server version and virtual host name which are added to server-generated pages<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;PATH_TRANSLATED\\&#8217;]<\/td>\n<td>Gives file system based path to the current script<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SCRIPT_NAME\\&#8217;]<\/td>\n<td>Gives path of the current script<\/td>\n<\/tr>\n<tr>\n<td>$_SERVER[\\&#8217;SCRIPT_URI\\&#8217;]<\/td>\n<td>Gives URI of the current page<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>What is $_SERVER in PHP $_SERVER is global variable \u00a0in PHP ,an array containing information such as headers, paths, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[3],"tags":[],"class_list":["post-228","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/comments?post=228"}],"version-history":[{"count":0,"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/posts\/228\/revisions"}],"wp:attachment":[{"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/media?parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/categories?post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/barkhane.com\/php\/wp-json\/wp\/v2\/tags?post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}