php-doc-en/reference/mongodb/configure.xml

243 lines
6.3 KiB
XML
Raw Normal View History

<?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;
<section xml:id="mongodb.installation.pecl">
<title>Installing the MongoDB PHP Driver with PECL</title>
<para>
&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:
<programlisting role="shell">
<![CDATA[
$ sudo pecl install mongodb
]]>
</programlisting>
</para>
<para>
Add the following line to your &php.ini; file:
<programlisting role="ini">
<![CDATA[
extension=mongodb.so
]]>
</programlisting>
</para>
</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>
<para>
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>
</para>
</section>
<section xml:id="mongodb.installation.hhvm">
<title>Manually Installing the MongoDB HHVM Driver</title>
<para>
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
$ git submodule sync && git submodule update --init --recursive
]]>
</programlisting>
</para>
<para>
Set up the make files by running:
<programlisting role="shell">
<![CDATA[
$ hphpize
$ cmake .
]]>
</programlisting>
</para>
<para>
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[
$ make configlib
]]>
</programlisting>
</para>
<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>
<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>
</para>
<para>
Add the following line to your &php.ini; file (usually found in "/etc/hhvm"):
<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>
</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
-->