<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/openssl.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'openssl.installation.php',
    1 => 'Installation',
    2 => 'Installation',
  ),
  'up' => 
  array (
    0 => 'openssl.setup.php',
    1 => 'Installing/Configuring',
  ),
  'prev' => 
  array (
    0 => 'openssl.requirements.php',
    1 => 'Requirements',
  ),
  'next' => 
  array (
    0 => 'openssl.configuration.php',
    1 => 'Runtime Configuration',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/configure.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="openssl.installation" class="section">
 <h2 class="title">Installation</h2>
 <p class="para">
  To use PHP&#039;s OpenSSL support you must also compile PHP <strong class="option configure">--with-openssl</strong>.
 </p>
 <p class="para">
  The OpenSSL library also has additional requirements for normal operation at
  run-time. Most notably, OpenSSL requires access to a random or pseudo-random
  number generator; on most Unix and Unix-like platforms (including Linux),
  this means that it must have access to a <code class="literal">/dev/urandom</code> or
  <code class="literal">/dev/random</code> device.
 </p>
 <p class="para">
  The configure option <strong class="option configure">--with-system-ciphers</strong>
  is available which causes PHP to use the system cipher list instead of a hard-coded default.
 </p>
 <blockquote class="note"><p><strong class="note">Note</strong>: 
  <strong>Note to Win32 Users</strong><br />
  <p class="para">
   In order for this extension to work, there are
<abbr title="Dynamic Link Library">DLL</abbr> files that must be available to the Windows
system <var class="envar">PATH</var>. For information on how to do this, see the
<abbr title="Frequently Asked Questions">FAQ</abbr> entitled &quot;<a href="faq.installation.php#faq.installation.addtopath" class="link">How do I add my PHP directory to the PATH
on Windows</a>&quot;. Although copying DLL
files from the PHP folder into the Windows system directory also works
(because the system directory is by default in the system&#039;s
<var class="envar">PATH</var>), this is not recommended.
<em>This extension requires the following files to be in the
<var class="envar">PATH</var>:</em> 
   <var class="filename">libeay32.dll</var>,
   or, as of OpenSSL 1.1, <var class="filename">libcrypto-*.dll</var>
  </p>
  <p class="para">
   Additionally, if you are planning to use the key generation and certificate
   signing functions, you will need to install a valid
   <var class="filename">openssl.cnf</var> file on your system.
   We include a sample configuration file
   in our win32 binary distributions, in the
   <var class="filename">extras/ssl</var> directory.
  </p>
  <p class="para">
   PHP will search for the <var class="filename">openssl.cnf</var> using the
   following logic:
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">the <code class="literal">OPENSSL_CONF</code> environmental variable, if
      set, will be used as the path (including filename) of the configuration
      file.
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">the <code class="literal">SSLEAY_CONF</code> environmental variable, if
      set, will be used as the path (including filename) of the configuration
      file.
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">The file <var class="filename">openssl.cnf</var> will be assumed to be
      found in the default certificate area, as configured at the time that
      the openssl DLL was compiled.  This is usually means that the default
      filename is <var class="filename">C:\Program Files\Common Files\SSL\openssl.cnf</var> (x64)
      or <var class="filename">C:\Program Files (x86)\Common Files\SSL\openssl.cnf</var> (x86), or,
      prior to PHP 7.4.0, <var class="filename">C:\usr\local\ssl\openssl.cnf</var>.
     </span>
    </li>
   </ul>
  </p>
  <span class="simpara">
   In your installation, you need to decide whether to install the
   configuration file in the default path or
   whether to install it someplace else and use environmental variables
   (possibly on a per-virtual-host basis) to locate the configuration file.
   Note that it is possible to override the default path from the script using
   the <code class="parameter">options</code> of the functions that require a
   configuration file.
  </span>
  <div class="caution"><strong class="caution">Caution</strong>
   <p class="simpara">
    Ensure that non-privileged users are not allowed to modify <var class="filename">openssl.cnf</var>.
   </p>
  </div>
  <span class="simpara">
   As of OpenSSL 3.0.0, which is used on Windows by default as of PHP 8.2.0, several
   algorithms have been deemed legacy. Such algorithms have commonly fallen out of use,
   have been deemed insecure by the cryptography community, or something similar.
   These algorithms are still available via the legacy provider
   (<var class="filename">extras/ssl/legacy.dll</var>); its usage is described in the
   <a href="https://docs.openssl.org/master/man5/config/#Provider-Configuration" class="link external">&raquo;&nbsp;provider configuration</a>
   section of the OpenSSL manual.
  </span>
 </p></blockquote>

 <div class="simplesect">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.4.0</td>
       <td>
        The <strong class="option configure">--with-openssl[=DIR]</strong> doesn&#039;t
        accept a directory argument anymore in favor of setting the pkg-config
        variable <var class="envar">PKG_CONFIG_PATH</var> to OpenSSL location, or by
        specifying the <var class="envar">OPENSSL_LIBS</var> and
        <var class="envar">OPENSSL_CFLAGS</var> variables.
       </td>
      </tr>

      <tr>
       <td>7.4.0</td>
       <td>
        The OpenSSL default config path has been changed from <var class="filename">C:\usr\local\ssl</var>
        to <var class="filename">C:\Program Files\Common Files\SSL</var> and
        <var class="filename">C:\Program Files (x86)\Common Files\SSL</var>, respectively.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

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