<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/security.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'security.hiding.php',
    1 => 'Hiding PHP',
    2 => 'Hiding PHP',
  ),
  'up' => 
  array (
    0 => 'security.php',
    1 => 'Sicurezza',
  ),
  'prev' => 
  array (
    0 => 'security.variables.php',
    1 => 'User Submitted Data',
  ),
  'next' => 
  array (
    0 => 'security.current.php',
    1 => 'Mantenere Stato Corrente',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'security/hiding.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="security.hiding" class="chapter">
   <h1 class="title">Hiding PHP</h1>

   <p class="para">
    In general, security by obscurity is one of the weakest forms of security.
    But in some cases, every little bit of extra security is desirable.
   </p>
   <p class="para">
    A few simple techniques can help to hide <abbr title="PHP: Hypertext Preprocessor">PHP</abbr>, possibly slowing
    down an attacker who is attempting to discover weaknesses in your
    system. By setting expose_php to <code class="literal">off</code> in your 
    <var class="filename">php.ini</var> file, you reduce the amount of information available to them.
   </p>
   <p class="para">
    Another tactic is to configure web servers such as apache to
    parse different filetypes through <abbr title="PHP: Hypertext Preprocessor">PHP</abbr>, either with an <var class="filename">.htaccess</var>
    directive, or in the apache configuration file itself. You can
    then use misleading file extensions:
    <div class="example" id="example-1">
     <p><strong>Example #1 Hiding PHP as another language</strong></p>
     <div class="example-contents">
<div class="apache-confcode"><pre class="apache-confcode"># Make PHP code look like other code types
AddType application/x-httpd-php .asp .py .pl</pre>
</div>
     </div>

    </div>
    Or obscure it completely:
    <div class="example" id="example-2">
     <p><strong>Example #2 Using unknown types for PHP extensions</strong></p>
     <div class="example-contents">
<div class="apache-confcode"><pre class="apache-confcode"># Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t</pre>
</div>
     </div>

    </div>
    Or hide it as <abbr title="Hyper Text Markup Language">HTML</abbr> code, which has a slight performance hit because
    all <abbr title="Hyper Text Markup Language">HTML</abbr> will be parsed through the <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> engine:
    <div class="example" id="example-3">
     <p><strong>Example #3 Using <abbr title="Hyper Text Markup Language">HTML</abbr> types for PHP extensions</strong></p>
     <div class="example-contents">
<div class="apache-confcode"><pre class="apache-confcode"># Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html</pre>
</div>
     </div>

    </div>
    For this to work effectively, you must rename your <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> files with
    the above extensions. While it is a form of security through
    obscurity, it&#039;s a minor preventative measure with few drawbacks.
   </p>
  </div>
<?php manual_footer($setup); ?>