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

304 lines
7.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="mongo.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
The MongoDB PHP driver should work on nearly any system: Windows, Mac OS X,
Unix, and Linux; little- and big-endian machines; 32- and 64-bit machines; PHP
5.2, 5.3, 5.4 and 5.5.
</para>
<para>
&pecl.moved;
</para>
<simplelist>
<member>
<xref linkend="mongo.installation.manual" />
</member>
<member>
<xref linkend="mongo.installation.nix" />
</member>
<member>
<xref linkend="mongo.installation.windows" />
</member>
<member>
<xref linkend="mongo.installation.osx" />
</member>
<member>
<xref linkend="mongo.installation.gentoo" />
</member>
<member>
<xref linkend="mongo.installation.fedora" />
</member>
<member>
<xref linkend="mongo.installation.thirdparty" />
</member>
</simplelist>
<section xml:id="mongo.installation.manual">
<title>Manual Installation</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>.
Go to Github and click the "download" button. Then run:
<programlisting role="shell">
<![CDATA[
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
$ cd mongodb-mongodb-php-driver-<commit_id>
$ phpize
$ ./configure
$ make all
$ sudo make install
]]>
</programlisting>
</para>
<para>
Make the following changes to php.ini:
</para>
<itemizedlist>
<listitem>
<para>
Make sure the <emphasis>extension_dir</emphasis> variable is pointing to
the directory containing <emphasis>mongo.so</emphasis>. The build will display where
it is installing the PHP driver with output that looks something like:
<programlisting role="txt">
<![CDATA[
Installing '/usr/lib/php/extensions/no-debug-non-zts-20060613/mongo.so'
]]>
</programlisting>
Make sure that it is the same as the PHP extension directory by runnning:
<programlisting role="shell">
<![CDATA[
$ php -i | grep extension_dir
extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20060613 =>
/usr/lib/php/extensions/no-debug-non-zts-20060613
]]>
</programlisting>
If it's not, change the <emphasis>extension_dir</emphasis> in php.ini or
move <emphasis>mongo.so</emphasis>.
</para>
</listitem>
<listitem>
<para>
To load the extension on PHP startup, add a line:
<programlisting role="ini">
<![CDATA[
extension=mongo.so
]]>
</programlisting>
</para>
</listitem>
</itemizedlist>
<section xml:id="mongo.installation.nix">
<title>Installing on *NIX</title>
<para>
Run:
<programlisting role="shell">
<![CDATA[
$ sudo pecl install mongo
]]>
</programlisting>
</para>
<para>
If you are using CentOS or Redhat, you may wish to install from an
<link xlink:href="&url.mongodb.rpm;">RPM</link>.
</para>
<para>
Add the following line to your php.ini file:
<programlisting role="ini">
<![CDATA[
extension=mongo.so
]]>
</programlisting>
</para>
<para>
If pecl runs out of memory while installing, make sure memory_limit in
php.ini is set to at least 128MB.
</para>
</section>
<section xml:id="mongo.installation.windows">
<title>Installing on Windows</title>
<para>
Precompiled binaries for each release are available from
<link xlink:href="&url.mongodb.downloads;">S3</link> for a variety
of combinations of versions, thread safety, and VC libraries. Unzip the
archive and put php_mongo.dll 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>
<note>
<title>Additional DLL dependencies for Windows Users</title>
<para>
&ext.windows.path.dll;
<filename>libsasl.dll</filename>
</para>
</note>
</section>
<section xml:id="mongo.installation.osx">
<title>OS X</title>
<para>
If your system is unable to find autoconf, you'll need to install Xcode
(available on your installation DVD or as a free download from the Apple
website).
</para>
<para>
In most cases installing from pecl is the easiest way:
<programlisting role="shell">
<![CDATA[
$ sudo pecl install mongo
]]>
</programlisting>
</para>
<para>
If you are using XAMPP, you may be able to compile the driver with the
following command:
<programlisting role="shell">
<![CDATA[
$ sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
]]>
</programlisting>
</para>
</section>
<section xml:id="mongo.installation.gentoo">
<title>Gentoo</title>
<para>
Gentoo has a package for the PHP PECL driver called dev-php/pecl-mongo, which can be
installed with:
</para>
<programlisting role="shell">
<![CDATA[
$ sudo emerge -va dev-php/pecl-mongo
]]>
</programlisting>
<para>
If you use PECL, you may get an error that libtool is the wrong version.
Compiling from source you'll need to run aclocal and autoconf.
</para>
<programlisting role="shell">
<![CDATA[
$ phpize
$ aclocal
$ autoconf
$ ./configure
$ make
$ sudo make install
]]>
</programlisting>
</section>
<section xml:id="mongo.installation.fedora">
<title>Red Hat</title>
<para>
This includes Fedora and CentOS.
</para>
<para>
The default Apache settings on these systems do not let requests make
network connections, meaning that the driver will get "Permission denied"
errors when it tries to connect to the database. If you run into this, try
running:
<programlisting role="shell">
<![CDATA[
$ /usr/sbin/setsebool -P httpd_can_network_connect 1
]]>
</programlisting>
Then restart Apache. (This issue has also occurred with SELinux.)
</para>
</section>
</section>
<section xml:id="mongo.installation.thirdparty">
<title>Third-Party Installation Instructions</title>
<para>
A number of people have created excellent tutorials on installing the PHP
driver.
</para>
<itemizedlist>
<listitem>
<para>
<link xlink:href="&url.mongodb.video;">
PHP 5.3.1 with Xdebug, MongoDB and Lithium on Ubuntu 9.10 / Apache 2.2
</link>
</para>
<para>An excellent video that takes you step-by-step through installing
Apache, PHP, Xdebug, MongoDB, and Lithium by Jon Adams.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="&url.mongodb.ubuntu.9.04;">
Installing MongoDB and the PHP driver on Ubuntu 9.04
</link>
</para>
<para>
Spanish article by Javier Aranda (<link xlink:href="&url.mongodb.ubuntu.9.04.en;">
English translation</link>).
</para>
</listitem>
<listitem>
<para>
<link xlink:href="&url.mongodb.osx;">
OS X: Installing MongoDB and the PHP Mongo Driver
</link>
</para>
<para>
By Matt Butcher.
</para>
</listitem>
</itemizedlist>
</section>
</section>
<!-- 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
-->