<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/reserved.variables.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'reserved.variables.server.php',
    1 => '$_SERVER',
    2 => 'Server and execution environment information',
  ),
  'up' => 
  array (
    0 => 'reserved.variables.php',
    1 => 'Predefined Variables',
  ),
  'prev' => 
  array (
    0 => 'reserved.variables.globals.php',
    1 => '$GLOBALS',
  ),
  'next' => 
  array (
    0 => 'reserved.variables.get.php',
    1 => '$_GET',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/predefined/variables/server.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reserved.variables.server" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">$_SERVER</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">$_SERVER</span> &mdash; <span class="dc-title">Server and execution environment information</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-reserved.variables.server-description">
  <h3 class="title">Descrizione</h3>
  <p class="para">
   <var class="varname">$_SERVER</var> is an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> containing information
   such as headers, paths, and script locations.
   The entries in this array are created by the web server, therefore there
   is no guarantee that every web server will provide any of these;
   servers may omit some, or provide others not listed here.
   However, most of these variables are accounted for in the
   <a href="https://datatracker.ietf.org/doc/html/rfc3875" class="link external">&raquo;&nbsp;CGI/1.1 specification</a>,
   and are likely to be defined.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    When running PHP on the <a href="features.commandline.php" class="link">command line</a>
    most of these entries will not be available or have any meaning.
   </span>
  </p></blockquote>
  <p class="para">
   In addition to the elements listed below, PHP will create additional
   elements with values from request headers. These entries will be named
   <code class="literal">HTTP_</code> followed by the header name,
   capitalized and with underscores instead of hyphens.
   For example, the <code class="literal">Accept-Language</code> header would be
   available as <code class="code">$_SERVER[&#039;HTTP_ACCEPT_LANGUAGE&#039;]</code>.
  </p>
 </div>


 <div class="refsect1 indices" id="refsect1-reserved.variables.server-indices">
  <h3 class="title">Indici</h3>

  <p class="para">
   <dl>
    
     <dt>&#039;<var class="varname">PHP_SELF</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The filename of the currently executing script, relative to
       the document root. For instance,
       <var class="varname">$_SERVER['PHP_SELF']</var> in a script at the
       address <var class="filename">http://example.com/foo/bar.php</var>
       would be <var class="filename">/foo/bar.php</var>.
       The <a href="language.constants.magic.php" class="link">__FILE__</a>
       constant contains the full path and filename of the current (i.e.
       included) file.
      </span>
      <span class="simpara">
       If PHP is running as a command-line processor this variable contains
       the script name.
      </span>
     </dd>
    

    
     <dt>&#039;<a href="reserved.variables.argv.php" class="link">argv</a>&#039;</dt>
     <dd>
      <span class="simpara">
       Array of arguments passed to the script. When the script is
       run on the command line, this gives C-style access to the
       command line parameters. When called via the GET method, this
       will contain the query string.
      </span>
     </dd>
    

    
     <dt>&#039;<a href="reserved.variables.argc.php" class="link">argc</a>&#039;</dt>
     <dd>
      <span class="simpara">
       Contains the number of command line parameters passed to the
       script (if run on the command line).
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">GATEWAY_INTERFACE</var>&#039;</dt>
     <dd>
      <span class="simpara">
       What revision of the CGI specification the server is using;
       e.g. <code class="literal">&#039;CGI/1.1&#039;</code>.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_ADDR</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The IP address of the server under which the current script is
       executing.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_NAME</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The name of the server host under which the current script is
       executing. If the script is running on a virtual host, this
       will be the value defined for that virtual host.
      </span>
      <blockquote class="note"><p><strong class="note">Nota</strong>: 
       <span class="simpara">
        Under Apache 2, <code class="literal">UseCanonicalName = On</code> and
        <code class="literal">ServerName</code> must be set. Otherwise, this value
        reflects the hostname supplied by the client, which can be spoofed.
        It is not safe to rely on this value in security-dependent contexts.
       </span>
      </p></blockquote>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_SOFTWARE</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Server identification string, given in the headers when
       responding to requests.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_PROTOCOL</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Name and revision of the information protocol via which the
       page was requested; e.g. <code class="literal">&#039;HTTP/1.0&#039;</code>;
      </span>
     </dd>
    
    
    
     <dt>&#039;<var class="varname">REQUEST_METHOD</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Which request method was used to access the page; e.g. <code class="literal">&#039;GET&#039;</code>,
       <code class="literal">&#039;HEAD&#039;</code>, <code class="literal">&#039;POST&#039;</code>, <code class="literal">&#039;PUT&#039;</code>.
      </span>
      <blockquote class="note"><p><strong class="note">Nota</strong>: 
       <p class="para">
        PHP script is terminated after sending headers (it means after
        producing any output without output buffering) if the request method
        was <code class="literal">HEAD</code>.
       </p>
      </p></blockquote>
     </dd>
    

    
     <dt>&#039;<var class="varname">REQUEST_TIME</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The timestamp when PHP started processing the request.
      </span>
     </dd>
    
    
    
     <dt>&#039;<var class="varname">REQUEST_TIME_FLOAT</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The timestamp when PHP started processing the request, with microsecond precision.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">QUERY_STRING</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The query string, if any, via which the page was accessed.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">DOCUMENT_ROOT</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The document root directory under which the current script is
       executing, as defined in the server&#039;s configuration file.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">HTTPS</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Set to a non-empty value if the script was queried through the HTTPS
       protocol.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">REMOTE_ADDR</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The IP address from which the user is viewing the current
       page.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">REMOTE_HOST</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The Host name from which the user is viewing the current
       page.  The reverse dns lookup is based on the 
       <var class="varname">REMOTE_ADDR</var> of the user.
      </span>
      <blockquote class="note"><p><strong class="note">Nota</strong>: 
       <span class="simpara">
        The web server must be configured to create this variable.
        For example in Apache <code class="literal">HostnameLookups On</code> must be
        set inside <var class="filename">httpd.conf</var> for it to exist.  See also
        <span class="function"><a href="function.gethostbyaddr.php" class="function">gethostbyaddr()</a></span>.
       </span>
      </p></blockquote>
     </dd>
    

    
     <dt>&#039;<var class="varname">REMOTE_PORT</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The port being used on the user&#039;s machine to communicate with
       the web server.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">REMOTE_USER</var>&#039;</dt>
     <dd>
      <span class="simpara">
        The authenticated user.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">REDIRECT_REMOTE_USER</var>&#039;</dt>
     <dd>
      <span class="simpara">
        The authenticated user if the request is internally redirected.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">SCRIPT_FILENAME</var>&#039;</dt>
     <dd>
      <p class="para">
       The absolute pathname of the currently executing script.
       <blockquote class="note"><p><strong class="note">Nota</strong>: 
        <p class="para">
         If a script is executed with the CLI, as a relative path,
         such as <var class="filename">file.php</var> or 
         <var class="filename">../file.php</var>, 
         <var class="varname">$_SERVER['SCRIPT_FILENAME']</var> will 
         contain the relative path specified by the user.
        </p>
       </p></blockquote>
      </p>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_ADMIN</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The value given to the SERVER_ADMIN (for Apache) directive in
       the web server configuration file. If the script is running
       on a virtual host, this will be the value defined for that
       virtual host.
      </span>
     </dd>
    
    
    
     <dt>&#039;<var class="varname">SERVER_PORT</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The port on the server machine being used by the web server
       for communication. For default setups, this will be <code class="literal">&#039;80&#039;</code>;
       using SSL, for instance, will change this to whatever your
       defined secure HTTP port is.
      </span>
      <blockquote class="note"><p><strong class="note">Nota</strong>: 
       <span class="simpara">
        Under Apache 2, <code class="literal">UseCanonicalName = On</code>, as well
        as <code class="literal">UseCanonicalPhysicalPort = On</code> must be set in
        order to get the physical (real) port, otherwise, this value can be
        spoofed, and it may or may not return the physical port value.
        It is not safe to rely on this value in security-dependent contexts.
       </span>
      </p></blockquote>
     </dd>
    

    
     <dt>&#039;<var class="varname">SERVER_SIGNATURE</var>&#039;</dt>
     <dd>
      <span class="simpara">
       String containing the server version and virtual host name
       which are added to server-generated pages, if enabled.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">PATH_TRANSLATED</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Filesystem- (not document root-) based path to the current
       script, after the server has done any virtual-to-real
       mapping.
      </span>
      <blockquote class="note"><p><strong class="note">Nota</strong>: 
       <span class="simpara">
        Apache 2 users may use <code class="literal">AcceptPathInfo = On</code> inside
        <var class="filename">httpd.conf</var> to define <var class="envar">PATH_INFO</var>.
       </span>
      </p></blockquote>
     </dd>
    

    
     <dt>&#039;<var class="varname">SCRIPT_NAME</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Contains the current script&#039;s path. This is useful for pages
       which need to point to themselves.
       The <a href="language.constants.magic.php" class="link">__FILE__</a>
       constant contains the full path and filename of the current (i.e.
       included) file.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">REQUEST_URI</var>&#039;</dt>
     <dd>
      <span class="simpara">
       The URI which was given in order to access this page; for
       instance, &#039;<code class="literal">/index.html</code>&#039;.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">PHP_AUTH_DIGEST</var>&#039;</dt>
     <dd>
      <span class="simpara">
       When doing Digest HTTP authentication this variable is set 
       to the &#039;Authorization&#039; header sent by the client (which you 
       should then use to make the appropriate validation).
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">PHP_AUTH_USER</var>&#039;</dt>
     <dd>
      <span class="simpara">
       When doing HTTP authentication this variable is set to the 
       username provided by the user.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">PHP_AUTH_PW</var>&#039;</dt>
     <dd>
      <span class="simpara">
       When doing HTTP authentication this variable is set to the 
       password provided by the user.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">AUTH_TYPE</var>&#039;</dt>
     <dd>
      <span class="simpara">
       When doing HTTP authentication this variable is set to the 
       authentication type.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">PATH_INFO</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Contains any client-provided pathname information trailing the
       actual script filename but preceding the query string, if available.
       For instance, if the current script was accessed via the URI
       <var class="filename">http://www.example.com/php/path_info.php/some/stuff?foo=bar</var>,
       then <var class="varname">$_SERVER['PATH_INFO']</var> would
       contain <code class="literal">/some/stuff</code>.
      </span>
     </dd>
    

    
     <dt>&#039;<var class="varname">ORIG_PATH_INFO</var>&#039;</dt>
     <dd>
      <span class="simpara">
       Original version of &#039;<var class="varname">PATH_INFO</var>&#039; before processed by
       PHP.
      </span>
     </dd>
    

   </dl>
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-reserved.variables.server-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="variable.server.basic">
    <p><strong>Example #1 <var class="varname">$_SERVER</var> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'SERVER_NAME'</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà
qualcosa simile a:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">www.example.com</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 notes" id="refsect1-reserved.variables.server-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: <p class="para">Questa è una variabile &#039;superglobale&#039;, o
automaticamente global. Ciò semplicemente significa che è visibile in 
tutti gli ambiti in uno script. Non è necessario dichiararla come
<strong class="command">global $variable;</strong> per accedervi da funzioni o metodi.
</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-reserved.variables.server-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="book.filter.php" class="link">The filter extension</a></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>