<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>$_SERVER Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/_server/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/_server/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 28 Aug 2021 11:55:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Tutorial for $_SERVER in Super Global Variables</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-_server-in-super-global-variables/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-_server-in-super-global-variables/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Sat, 28 Aug 2021 11:55:06 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[$_SERVER]]></category>
		<category><![CDATA[$_SERVER in Super Global Variables]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[Super Global Variables]]></category>
		<category><![CDATA[Super Global Variables in PHP]]></category>
		<category><![CDATA[Tutorial for $_SERVER in Super Global Variables]]></category>
		<category><![CDATA[Tutorial for Super Global Variables]]></category>
		<category><![CDATA[Tutorial for Super Global Variables in PHP]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is $_SERVER?]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=8454</guid>

					<description><![CDATA[<p>What is $_SERVER? It&#8217;s a super global variable in PHP that keeps track of headers, paths, and script locations. Some [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-_server-in-super-global-variables/">Tutorial for $_SERVER in Super Global Variables</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">What is $_SERVER?</h3>



<p class="wp-block-paragraph">It&#8217;s a super global variable in PHP that keeps track of headers, paths, and script locations. Some of these components are used to obtain data from the $_SERVER super global variables.</p>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="https://www.drupal.org/files/project-images/img1.JPG" alt="Server IP (PHP $_SERVER variables) | Drupal.org"/></figure></div>



<p class="wp-block-paragraph"><strong>Example:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/f8ba136f146759bad9897a6c29b754d0.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="883" height="181" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-192.png" alt="" class="wp-image-8460" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-192.png 883w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-192-300x61.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-192-768x157.png 768w" sizes="(max-width: 883px) 100vw, 883px" /></figure></div>



<p class="wp-block-paragraph">To retrieve some information, we used the $_SERVER components in the code above. Using the ‘PHP SELF&#8217; element, we retrieve the current file name that is being worked on. Then, using the ‘SERVER NAME&#8217; attribute, we retrieve the current server name. Then we use ‘HTTP HOST&#8217; to retrieve the host name.</p>



<p class="wp-block-paragraph"><strong>The following table lists the most important elements that can go inside $_SERVER:</strong></p>



<figure class="wp-block-table"><table><tbody><tr><th><span class="has-inline-color has-vivid-red-color">Element/Code</span></th><th><span class="has-inline-color has-vivid-purple-color">Description</span></th></tr><tr><td>$_SERVER[&#8216;PHP_SELF&#8217;]</td><td>Returns the filename of the currently executing script</td></tr><tr><td>$_SERVER[&#8216;GATEWAY_INTERFACE&#8217;]</td><td>Returns the version of the Common Gateway Interface (CGI) the server is using</td></tr><tr><td>$_SERVER[&#8216;SERVER_ADDR&#8217;]</td><td>Returns the IP address of the host server</td></tr><tr><td>$_SERVER[&#8216;SERVER_NAME&#8217;]</td><td>Returns the name of the host server (such as www.w3schools.com)</td></tr><tr><td>$_SERVER[&#8216;SERVER_SOFTWARE&#8217;]</td><td>Returns the server identification string (such as Apache/2.2.24)</td></tr><tr><td>$_SERVER[&#8216;SERVER_PROTOCOL&#8217;]</td><td>Returns the name and revision of the information protocol (such as HTTP/1.1)</td></tr><tr><td>$_SERVER[&#8216;REQUEST_METHOD&#8217;]</td><td>Returns the request method used to access the page (such as POST)</td></tr><tr><td>$_SERVER[&#8216;REQUEST_TIME&#8217;]</td><td>Returns the timestamp of the start of the request (such as 1377687496)</td></tr><tr><td>$_SERVER[&#8216;QUERY_STRING&#8217;]</td><td>Returns the query string if the page is accessed via a query string</td></tr><tr><td>$_SERVER[&#8216;HTTP_ACCEPT&#8217;]</td><td>Returns the Accept header from the current request</td></tr><tr><td>$_SERVER[&#8216;HTTP_ACCEPT_CHARSET&#8217;]</td><td>Returns the Accept_Charset header from the current request (such as utf-8,ISO-8859-1)</td></tr><tr><td>$_SERVER[&#8216;HTTP_HOST&#8217;]</td><td>Returns the Host header from the current request</td></tr><tr><td>$_SERVER[&#8216;HTTP_REFERER&#8217;]</td><td>Returns the complete URL of the current page (not reliable because not all user-agents support it)</td></tr><tr><td>$_SERVER[&#8216;HTTPS&#8217;]</td><td>Is the script queried through a secure HTTP protocol</td></tr><tr><td>$_SERVER[&#8216;REMOTE_ADDR&#8217;]</td><td>Returns the IP address from where the user is viewing the current page</td></tr><tr><td>$_SERVER[&#8216;REMOTE_HOST&#8217;]</td><td>Returns the Host name from where the user is viewing the current page</td></tr><tr><td>$_SERVER[&#8216;REMOTE_PORT&#8217;]</td><td>Returns the port being used on the user&#8217;s machine to communicate with the web server</td></tr><tr><td>$_SERVER[&#8216;SCRIPT_FILENAME&#8217;]</td><td>Returns the absolute pathname of the currently executing script</td></tr><tr><td>$_SERVER[&#8216;SERVER_ADMIN&#8217;]</td><td>Returns the 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) (such as someone@w3schools.com)</td></tr><tr><td>$_SERVER[&#8216;SERVER_PORT&#8217;]</td><td>Returns the port on the server machine being used by the web server for communication (such as 80)</td></tr><tr><td>$_SERVER[&#8216;SERVER_SIGNATURE&#8217;]</td><td>Returns the server version and virtual host name which are added to server-generated pages</td></tr><tr><td>$_SERVER[&#8216;PATH_TRANSLATED&#8217;]</td><td>Returns the file system based path to the current script</td></tr><tr><td>$_SERVER[&#8216;SCRIPT_NAME&#8217;]</td><td>Returns the path of the current script</td></tr><tr><td>$_SERVER[&#8216;SCRIPT_URI&#8217;]</td><td>Returns the URI of the current page</td></tr></tbody></table></figure>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-_server-in-super-global-variables/">Tutorial for $_SERVER in Super Global Variables</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-_server-in-super-global-variables/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
