mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Improve MongoDB installation docs for 1.4.0
This improves discussion around configure options for manual builds, reminds users that each version of PHP has its own PECL command and INI file, and encourages Homebrew users to rely on the formula install method. https://jira.mongodb.org/browse/PHPC-1055 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@343859 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
435617f0f2
commit
fd4b1601e4
1 changed files with 86 additions and 32 deletions
|
@ -13,7 +13,7 @@
|
|||
</para>
|
||||
|
||||
<para>
|
||||
Linux, Unix, and OS X users may run the following command to install the
|
||||
Linux, Unix, and macOS users may run the following command to install the
|
||||
driver:
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
@ -24,19 +24,39 @@ $ sudo pecl install mongodb
|
|||
|
||||
<note>
|
||||
<simpara>
|
||||
Installing the driver via PECL will use bundled versions of
|
||||
<link xlink:href="&url.mongodb.libbson;">libbson</link> and
|
||||
<link xlink:href="&url.mongodb.libmongoc;">libmongoc</link> and rely on PHP
|
||||
to find OpenSSL (i.e. <literal>PHP_SETUP_OPENSSL</literal>). If the build
|
||||
process fails to find OpenSSL, check that the OpenSSL development package
|
||||
(e.g. <literal>libssl-dev</literal>) and
|
||||
<link xlink:href="&url.mongodb.wiki.pkg-config;">pkg-config</link> are both
|
||||
installed.
|
||||
macOS Homebrew users should consider using the
|
||||
<link linkend="mongodb.installation.homebrew">Homebrew installation</link>
|
||||
process instead of manually installing the driver via PECL.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Add the following line to your &php.ini; file:
|
||||
If your system has multiple version of PHP installed (e.g. macOS default
|
||||
<emphasis>and</emphasis> <link xlink:href="&url.xampp;">XAMPP</link>), note
|
||||
that each version of PHP has its own <link linkend="install.pecl">pecl</link>
|
||||
command and &php.ini; file.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Installing the driver via PECL will use bundled versions of
|
||||
<link xlink:href="&url.mongodb.libbson;">libbson</link> and
|
||||
<link xlink:href="&url.mongodb.libmongoc;">libmongoc</link> and attempt to
|
||||
automatically configure them.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<simpara>
|
||||
If the build process fails to find an SSL library, check that the
|
||||
development packages (e.g. <literal>libssl-dev</literal>) and
|
||||
<link xlink:href="&url.mongodb.wiki.pkg-config;">pkg-config</link> are both
|
||||
installed. If that does not resolve the problem, consider using the
|
||||
<link linkend="mongodb.installation.manual">manual installation</link>
|
||||
process.
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Finally, add the following line to your &php.ini; file:
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
extension=mongodb.so
|
||||
|
@ -46,25 +66,19 @@ extension=mongodb.so
|
|||
</section>
|
||||
|
||||
<section xml:id="mongodb.installation.homebrew">
|
||||
<title>Installing the MongoDB PHP Driver on OSX with Homebrew</title>
|
||||
<title>Installing the MongoDB PHP Driver on macOS 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 tap homebrew/homebrew-php
|
||||
$ brew install php70-mongodb
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -104,31 +118,71 @@ extension=php_mongodb.dll
|
|||
<![CDATA[
|
||||
$ git clone https://github.com/mongodb/mongo-php-driver.git
|
||||
$ cd mongo-php-driver
|
||||
$ git submodule sync && git submodule update --init
|
||||
$ git submodule update --init
|
||||
$ phpize
|
||||
$ ./configure
|
||||
$ make all -j 5
|
||||
$ make all
|
||||
$ sudo make install
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If your system has multiple version of PHP installed (e.g. macOS default
|
||||
<emphasis>and</emphasis> <link xlink:href="&url.xampp;">XAMPP</link>), note
|
||||
that each version of PHP has its own
|
||||
<link linkend="install.pecl.phpize">phpize</link> command and &php.ini; file.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By default, the driver will use bundled versions of
|
||||
<link xlink:href="&url.mongodb.libbson;">libbson</link> and
|
||||
<link xlink:href="&url.mongodb.libmongoc;">libmongoc</link> and attempt to
|
||||
configure them on its own. If libbson and libmongoc are already installed as
|
||||
system libraries, you can instruct the driver to utilize them by specifying
|
||||
<literal>--with-libbson=yes --with--libmongoc=yes</literal> as arguments to
|
||||
<literal>configure</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For a complete list of <literal>configure</literal> options, run
|
||||
<command>configure --help</command>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When using bundled versions of libbson and libmongoc, the driver will also
|
||||
attempt to select an SSL library according to the
|
||||
<literal>--with-mongodb-ssl</literal> option for
|
||||
<literal>configure</literal>. The default value is
|
||||
<literal>--with-mongodb-ssl=auto</literal>, which will search for OpenSSL,
|
||||
LibreSSL, and Secure Transport (macOS only), in that order. Additionally, you
|
||||
may specify <literal>openssl</literal>, <literal>libressl</literal>, or
|
||||
<literal>darwin</literal> to force selection of a particular library,
|
||||
respectively.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<simpara>
|
||||
By default, the driver will use bundled versions of
|
||||
<link xlink:href="&url.mongodb.libbson;">libbson</link> and
|
||||
<link xlink:href="&url.mongodb.libmongoc;">libmongoc</link> and rely on PHP
|
||||
to find OpenSSL (i.e. <literal>PHP_SETUP_OPENSSL</literal>). If the build
|
||||
process fails to find OpenSSL, check that the OpenSSL development package
|
||||
(e.g. <literal>libssl-dev</literal>) and
|
||||
<para>
|
||||
If the build process fails to find an SSL library, check that the
|
||||
development packages (e.g. <literal>libssl-dev</literal>) and
|
||||
<link xlink:href="&url.mongodb.wiki.pkg-config;">pkg-config</link> are both
|
||||
installed.
|
||||
</simpara>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When using Homebrew on macOS, it is common for a system to have multiple
|
||||
versions of OpenSSL installed. To ensure that the desired version of OpenSSL
|
||||
is selected, the <literal>PKG_CONFIG_PATH</literal> environment variable may
|
||||
be used to control the search path for <literal>pkg-config</literal>. If
|
||||
<literal>pkg-config</literal> is not used, <literal>configure</literal> also
|
||||
supports a <literal>--with-openssl-dir=DIR</literal> argument, which can be
|
||||
used to specify a manual search path (for OpenSSL only).
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The last step will report where <filename>mongodb.so</filename> has been
|
||||
installed, similar to:
|
||||
The final build step, <command>make install</command>, 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/
|
||||
|
@ -139,7 +193,7 @@ Installing shared extensions: /usr/lib/php/extensions/debug-non-zts-20151012
|
|||
<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:
|
||||
was installed. You can query for the option by running:
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
$ php -i | grep extension_dir
|
||||
|
@ -156,7 +210,7 @@ $ php -i | grep extension_dir
|
|||
</para>
|
||||
|
||||
<para>
|
||||
Add the following line to your &php.ini; file:
|
||||
Finally, add the following line to your &php.ini; file:
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
extension=mongodb.so
|
||||
|
|
Loading…
Reference in a new issue