<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.pecl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'install.pecl.windows.php',
    1 => 'Installing a PHP extension on Windows',
    2 => 'Installing a PHP extension on Windows',
  ),
  'up' => 
  array (
    0 => 'install.pecl.php',
    1 => 'Installation of PECL extensions',
  ),
  'prev' => 
  array (
    0 => 'install.pecl.downloads.php',
    1 => 'Downloading PECL extensions',
  ),
  'next' => 
  array (
    0 => 'install.pecl.pear.php',
    1 => 'Compiling shared PECL extensions with the pecl command',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'install/pecl.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.pecl.windows" class="sect1">
  <h2 class="title">Installing a PHP extension on Windows</h2>
  <p class="para">
   There are two ways to load a PHP extension on Windows: either compile it into
   PHP, or load the DLL.
   Loading a pre-compiled extension is the easiest and preferred way.
  </p>
  <p class="para">
   To load an extension, it has to be available as a
   <var class="filename">.dll</var>
   file on the system.
   All the extensions are automatically and periodically compiled by the PHP
   Group (see next section for the download).
  </p>
  <p class="para">
   To compile an extension into PHP, please refer to the
   <a href="install.windows.building.php" class="link">building from source</a>
   documentation.
  </p>
  <p class="para">
   To compile a standalone extension (aka a DLL file), please refer to the
   <a href="install.windows.building.php" class="link">building from source</a>
   documentation.
   If the DLL file is available neither with the PHP distribution nor in PECL,
   it may be necessary to compile it before the extension can be used.
  </p>
  <div class="sect2" id="install.pecl.windows.find">
   <h3 class="title">Where to find an extension?</h3>
   <p class="para">
    PHP extensions are usually called <var class="filename">php_*.dll</var> (where the
    star represents the name of the extension), and they are located under the
    <var class="filename">PHP\ext</var>
    folder.
   </p>
   <p class="para">
    PHP ships with the extensions most useful to the majority of developers.
    They are called <em>bundled</em> extensions.
   </p>
   <p class="para">
    However, if the bundled extensions do not provide the needed functionality,
    one extension that does may still be found in <a href="https://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a>.
    The PHP Extension Community Library (PECL) is a repository for PHP
    Extensions, providing a directory of all known extensions and hosting
    facilities for downloading and developing PHP extensions.
   </p>
   <p class="para">
    If an extension has been developed for particular uses, it may be hosted on
    PECL so that others with the same needs can benefit from it.
    A nice side effect is that it&#039;s a good chance to receive feedback,
    (hopefully) thanks, bug reports and even fixes/patches.
    Before submitting an extension for hosting on PECL, please read
    <a href="https://pecl.php.net/package-new.php" class="link external">&raquo;&nbsp;PECL submit</a>.
   </p>
  </div>

  <div class="sect2" id="install.pecl.windows.which">
   <h3 class="title">Which extension to download?</h3>
   <p class="para">
    <em>
     Many times, there will be several versions of each DLL available:
    </em>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       Different version numbers (at least the first two numbers should match)
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       Different thread safety settings
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       Different processor architecture (x86, x64, ...)
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       Different debugging settings
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <code class="literal">etc.</code>
      </span>
     </li>
    </ul>
   </p>
   <p class="para">
    Keep in mind that the extension settings should match all the settings of
    the PHP executable being used.
    The following PHP script will tell <em>all</em> about the PHP
    settings:
   </p>
   <p class="para">
    <div class="example" id="example-1">
     <p><strong>Example #1 
      <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span>
      call
     </strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />phpinfo</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
   <p class="para">
    Or from the command line, run:
    <div class="example-contents screen">
<div class="cdata"><pre>
drive:\path\to\php\executable\php.exe -i
</pre></div>
    </div>
   </p>
  </div>

  <div class="sect2" id="install.pecl.windows.loading">
   <h3 class="title">Loading an extension</h3>
   <p class="para">
    The most common way to load a PHP extension is to include it in
    the <var class="filename">php.ini</var> configuration file.
    Please note that many extensions are already present in the <var class="filename">php.ini</var> and
    that the semicolon only needs to be removed to activate them.
   </p>
   <p class="para">
    Note that, as of PHP 7.2.0, the extension name may be used
    instead of the extension&#039;s file name.
    As this is OS-independent and easier, especially for newcomers, it becomes
    the recommended way of specifying extensions to load.
    File names remain supported for compatibility with prior versions.
   </p>
   <div class="example-contents screen">
<div class="cdata"><pre>
;extension=php_extname.dll
</pre></div>
   </div>
   <div class="example-contents screen">
<div class="cdata"><pre>
extension=php_extname.dll
</pre></div>
   </div>
   <div class="example-contents screen">
<div class="cdata"><pre>
; As of PHP 7.2.0, prefer:
extension=extname
zend_extension=another_extension
</pre></div>
   </div>
   <p class="para">
    However, some web servers are confusing because they do not use
    the <var class="filename">php.ini</var> located alongside the PHP executable.
    To find out where the actual <var class="filename">php.ini</var> resides, look for its path
    in <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span>:
   </p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Configuration File (php.ini) Path  C:\WINDOWS
</pre></div>
   </div>
   <div class="example-contents screen">
<div class="cdata"><pre>
Loaded Configuration File   C:\Program Files\PHP\8.2\php.ini
</pre></div>
   </div>
   <p class="para">
    After activating an extension, save <var class="filename">php.ini</var>, restart the web server, and
    check <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> again.
    The new extension should now have its own section.
   </p>
  </div>

  <div class="sect2" id="install.pecl.windows.problemsolving">
   <h3 class="title">Resolving problems</h3>
   <p class="para">
    If the extension does not appear in <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span>,
    the logs should be checked to learn where the problem comes from.
   </p>
   <p class="para">
    If PHP is being used from the command line (CLI), the extension loading
    error can be read directly on the screen.
   </p>
   <p class="para">
    If PHP is being used with a web server, the location and format of the logs
    vary depending on the software.
    Please read the web server documentation to locate the logs, as it has
    nothing to do with PHP itself.
   </p>
   <p class="para">
    Common problems are the location of the DLL and the DLLs it depends on, the
    value of the &quot;<a href="ini.core.php#ini.extension-dir" class="link">extension_dir</a>&quot;
    setting inside <var class="filename">php.ini</var> and compile-time setting mismatches.
   </p>
   <p class="para">
    If the problem lies in a compile-time setting mismatch, probably the DLL
    downloaded is not the right one.
    Try downloading the extension again with the proper settings.
    Again, <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> can be of great help.
   </p>
  </div>

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