<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Installing the MongoDB PHP Driver with PECL</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongodb.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongodb.installation.homebrew.html">Installing the MongoDB PHP Driver on macOS with Homebrew (deprecated)</a></div> <div class="up"><a href="mongodb.installation.html">Installation</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mongodb.installation.pecl" class="section"> <h2 class="title">Installing the MongoDB PHP Driver with PECL</h2> <p class="para"> Information for installing this PECL extension may be found in the manual chapter titled <a href="install.pecl.html" class="link">Installation of PECL extensions</a>. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: <a href="http://pecl.php.net/package/mongodb" class="link external">» http://pecl.php.net/package/mongodb</a> </p> <p class="para"> Linux, Unix, and macOS users may run the following command to install the driver: <div class="example-contents"> <div class="shellcode"><pre class="shellcode">$ sudo pecl install mongodb</pre> </div> </div> </p> <p class="para"> If your system has multiple version of PHP installed (e.g. macOS default <em class="emphasis">and</em> <a href="https://www.apachefriends.org/" class="link external">» XAMPP</a>), note that each version of PHP has its own <a href="install.pecl.html" class="link">pecl</a> command and <var class="filename">php.ini</var> file. </p> <p class="para"> Installing the driver via PECL will use bundled versions of <a href="https://github.com/mongodb/libbson" class="link external">» libbson</a> and <a href="https://github.com/mongodb/mongo-c-driver" class="link external">» libmongoc</a> and attempt to automatically configure them. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> If the build process fails to find an SSL library, check that the development packages (e.g. <em>libssl-dev</em>) and <a href="https://en.wikipedia.org/wiki/Pkg-config" class="link external">» pkg-config</a> are both installed. If that does not resolve the problem, consider using the <a href="mongodb.installation.manual.html" class="link">manual installation</a> process. </span> </p></blockquote> <p class="para"> Finally, add the following line to your <var class="filename">php.ini</var> file: <div class="example-contents"> <div class="inicode"><pre class="inicode">extension=mongodb.so</pre> </div> </div> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongodb.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongodb.installation.homebrew.html">Installing the MongoDB PHP Driver on macOS with Homebrew (deprecated)</a></div> <div class="up"><a href="mongodb.installation.html">Installation</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>