2015-03-24 18:15:02 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
|
|
<article xml:id="mongodb.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
&reftitle.install;
|
|
|
|
|
2016-01-24 05:09:52 +00:00
|
|
|
<section xml:id="mongodb.installation.pecl">
|
|
|
|
<title>Installing the MongoDB PHP Driver with PECL</title>
|
2015-03-24 18:15:02 +00:00
|
|
|
|
2015-09-23 15:35:13 +00:00
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
&pecl.info;
|
|
|
|
<link xlink:href="&url.pecl.package;mongodb">&url.pecl.package;mongodb</link>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Linux, Unix, and OS X users may run the following command to install the
|
|
|
|
driver:
|
2015-09-23 15:35:13 +00:00
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ sudo pecl install mongodb
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
Add the following line to your &php.ini; file:
|
2015-09-23 15:35:13 +00:00
|
|
|
<programlisting role="ini">
|
|
|
|
<![CDATA[
|
|
|
|
extension=mongodb.so
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
2016-01-24 05:09:52 +00:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section xml:id="mongodb.installation.homebrew">
|
|
|
|
<title>Installing the MongoDB PHP Driver on OSX with Homebrew</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
If you are using <link xlink:href="&url.mac.homebrew;">Homebrew</link>, the
|
|
|
|
PHP tap includes formulae for installing the driver on various PHP versions.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<simplelist>
|
|
|
|
<member>php54-mongodb</member>
|
|
|
|
<member>php55-mongodb</member>
|
|
|
|
<member>php56-mongodb</member>
|
|
|
|
<member>php70-mongodb</member>
|
|
|
|
</simplelist>
|
2015-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
For example, you might install the driver for PHP 7.0 using the following
|
|
|
|
command:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ brew install php70-mongodb
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section xml:id="mongodb.installation.windows">
|
|
|
|
<title>Installing the MongoDB PHP Driver on Windows</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Precompiled binaries for each release are available from
|
|
|
|
<link xlink:href="&url.pecl.package;mongodb">PECL</link> for a variety of
|
|
|
|
combinations of versions, thread safety, and VC libraries. Extract the
|
|
|
|
archive and put <filename>php_mongo.dll</filename> in your PHP extension
|
|
|
|
directory ("ext" by default).
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Add the following line to your &php.ini; file:
|
|
|
|
<programlisting role="ini">
|
|
|
|
<![CDATA[
|
|
|
|
extension=php_mongo.dll
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section xml:id="mongodb.installation.manual">
|
|
|
|
<title>Manually Installing the MongoDB PHP Driver</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
For driver developers and people interested in the latest bugfixes, you can
|
|
|
|
compile the driver from the latest source code on
|
|
|
|
<link xlink:href="&url.mongodb.github;">Github</link>. Run the following
|
|
|
|
commands to clone and build the project:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ git clone https://github.com/mongodb/mongo-php-driver.git
|
|
|
|
$ cd mongo-php-driver
|
|
|
|
$ git submodule sync && git submodule update --init
|
|
|
|
$ phpize
|
|
|
|
$ ./configure
|
|
|
|
$ make all -j 5
|
|
|
|
$ sudo make install
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The last step will report where <filename>mongodb.so</filename> has been
|
|
|
|
installed, similar to:
|
|
|
|
<programlisting role="txt">
|
|
|
|
<![CDATA[
|
|
|
|
Installing shared extensions: /usr/lib/php/extensions/debug-non-zts-20151012/
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Ensure that the <link linkend="ini.extension-dir">extension_dir</link> option
|
|
|
|
in &php.ini; points to the directory where <filename>mongodb.so</filename>
|
|
|
|
was installed. You can query the option by running:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ php -i | grep extension_dir
|
|
|
|
extension_dir => /usr/lib/php/extensions/debug-non-zts-20151012 =>
|
|
|
|
/usr/lib/php/extensions/debug-non-zts-20151012
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
If the directories differ, either change
|
|
|
|
<link linkend="ini.extension-dir">extension_dir</link> in &php.ini; or
|
|
|
|
manually move <filename>mongodb.so</filename> to the correct directory.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Add the following line to your &php.ini; file:
|
|
|
|
<programlisting role="ini">
|
|
|
|
<![CDATA[
|
|
|
|
extension=mongodb.so
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
2015-09-23 15:35:13 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section xml:id="mongodb.installation.hhvm">
|
2016-01-24 05:09:52 +00:00
|
|
|
<title>Manually Installing the MongoDB HHVM Driver</title>
|
2015-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
At the time of this writing, HHVM does not have a package manager for
|
|
|
|
extensions. Download the latest driver from
|
|
|
|
<link xlink:href="&url.mongodb.hhvm.releases;">GitHub</link>. Alternatively,
|
|
|
|
you may clone the repository to build the latest source code:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ git clone https://github.com/mongodb/mongo-hhvm-driver.git
|
|
|
|
$ cd mongo-hhvm-driver
|
2016-07-14 09:40:12 +00:00
|
|
|
$ git submodule sync && git submodule update --init --recursive
|
2016-01-24 05:09:52 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
2015-09-23 15:35:13 +00:00
|
|
|
</para>
|
|
|
|
|
2016-07-13 14:38:43 +00:00
|
|
|
<para>
|
|
|
|
Set up the make files by running:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ hphpize
|
|
|
|
$ cmake .
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
2015-09-23 15:35:13 +00:00
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
Generate the <code>configure</code> files for the bundled libraries. For this
|
|
|
|
this to work, you need to have the <code>automake</code>,
|
|
|
|
<code>autoconf</code>, and <code>libtool</code> packages installed (e.g.
|
|
|
|
through <code>apt-get</code>).
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
2016-07-13 14:38:43 +00:00
|
|
|
$ make configlib
|
2016-01-24 05:09:52 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
2015-09-23 15:35:13 +00:00
|
|
|
|
2016-01-24 05:09:52 +00:00
|
|
|
<para>
|
|
|
|
Build and install the driver by running:
|
|
|
|
<programlisting role="shell">
|
|
|
|
<![CDATA[
|
|
|
|
$ make -j 5
|
|
|
|
$ sudo make install
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
If the <code>hphpize</code> command is not available, you will need to
|
|
|
|
either compile HHVM from source or install the <code>hhvm-dev</code> package
|
|
|
|
(e.g. through <code>apt-get</code>).
|
|
|
|
</para>
|
|
|
|
</note>
|
2015-11-11 18:51:47 +00:00
|
|
|
|
2016-01-24 05:09:52 +00:00
|
|
|
<para>
|
|
|
|
The last step will report where <filename>mongodb.so</filename> has been
|
|
|
|
installed, similar to:
|
|
|
|
<programlisting role="txt">
|
|
|
|
<![CDATA[
|
|
|
|
Installing: /usr/local/hhvm/3.9.1/lib/hhvm/extensions/20150212/mongodb.so
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
2015-09-23 15:35:13 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2016-01-24 05:09:52 +00:00
|
|
|
Add the following line to your &php.ini; file (usually found in "/etc/hhvm"):
|
2015-09-23 15:35:13 +00:00
|
|
|
<programlisting role="ini">
|
|
|
|
<![CDATA[
|
|
|
|
hhvm.dynamic_extension_path=/usr/local/hhvm/3.9.1/lib/hhvm/extensions/20150212
|
|
|
|
hhvm.dynamic_extensions[mongodb]=mongodb.so
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|
2015-03-24 18:15:02 +00:00
|
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|