Skip to content

Commit e5c1c39

Browse files
committed
wip
1 parent e1fe3f3 commit e5c1c39

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

source/php-drivers.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,65 @@ provides the following functionality:
101101
To learn more about the system libraries, see the `C Driver
102102
<https://www.mongodb.com/docs/languages/c/c-driver/current/>`__ documentation.
103103

104+
Connect to a Compatible MongoDB Deployment
105+
------------------------------------------
106+
107+
You can use the PHP driver to connect to deployments hosted in the
108+
following environments:
109+
110+
.. include:: /includes/fact-environments.rst
111+
112+
Installation
113+
------------
114+
115+
Make sure you have a recent version of PHP installed on your
116+
system. See the `PHP manual <https://www.php.net/manual/en/install.php>`__
117+
for download and installation instructions.
118+
119+
Install the PHP MongoDB Extension before you install the MongoDB PHP
120+
Library. You can install the extension by using `PECL
121+
<https://www.php.net/manual/en/mongodb.installation.php>`__ on the
122+
command line:
123+
124+
.. code-block:: sh
125+
126+
sudo pecl install mongodb
127+
128+
After installation completes, add the following line to your ``php.ini``
129+
file:
130+
131+
.. code-block:: text
132+
133+
extension=mongodb.so
134+
135+
.. note::
136+
137+
On some systems, there might be multiple ``.ini`` files for
138+
individual SAPIs (e.g. CLI, FPM). Make sure to enable the extension
139+
in all SAPIs that you use.
140+
141+
Then, install the PHP library by using `Composer
142+
<https://getcomposer.org/>`__. Run the following command from your
143+
project directory:
144+
145+
.. code-block:: sh
146+
147+
composer require mongodb/mongodb
148+
149+
After installation completes, ensure that your application includes
150+
Composer's autoloader as shown in the following example:
151+
152+
.. code-block:: php
153+
154+
<?php
155+
156+
require_once __DIR__ . '/vendor/autoload.php';
157+
158+
The `PHP Library documentation
159+
<https://www.mongodb.com/docs/php-library/current>`__ contains reference
160+
materials and tutorials that demonstrate how to interact with your
161+
MongoDB data.
162+
104163
Compatibility
105164
-------------
106165

0 commit comments

Comments
 (0)