-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-41952: Download and Install #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
norareidy
merged 8 commits into
mongodb:php-standardization
from
norareidy:DOCSP-41952-download-install
Aug 21, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6418d93
DOCSP-41952: Download and Install
norareidy 5ef0ac6
edits
norareidy 005d830
toc, fixes
norareidy cc32aa5
AS feedback
norareidy 186f149
AS feedback 2
norareidy 48abf5f
typo
norareidy 0582736
JT feedback
norareidy 4d951ea
Merge remote-tracking branch 'upstream/php-standardization' into DOCS…
norareidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
.. _php-download-and-install: | ||
|
||
==================== | ||
Download and Install | ||
==================== | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: tutorial | ||
|
||
.. meta:: | ||
:keywords: setup, composer, installation, code example | ||
|
||
.. procedure:: | ||
:style: connected | ||
|
||
.. step:: Install dependencies | ||
|
||
Before you begin developing, ensure that you have the following | ||
dependencies installed on your local machine: | ||
|
||
- `PHP <https://www.php.net/manual/en/install.php>`__ version 7.4 or later | ||
- `Composer <https://getcomposer.org/download/>`__ version 2.0 or later | ||
|
||
.. step:: Install the MongoDB PHP extension | ||
|
||
Run the following command to install the ``mongodb`` PHP extension: | ||
|
||
.. code-block:: bash | ||
|
||
sudo pecl install mongodb | ||
|
||
.. step:: Update your PHP configuration file | ||
|
||
To enable the ``mongodb`` extension in your PHP configuration file, add the | ||
following line to the top of your ``php.ini`` file: | ||
norareidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. code-block:: none | ||
|
||
extension=mongodb.so | ||
|
||
.. tip:: | ||
|
||
You can locate your ``php.ini`` file by running the following command | ||
in your shell: | ||
|
||
.. code-block:: bash | ||
|
||
php --ini | ||
|
||
.. step:: Create a project directory | ||
|
||
From your root directory, run the following command in your shell to create | ||
a directory called ``php-quickstart`` for this project: | ||
|
||
.. code-block:: bash | ||
|
||
mkdir php-quickstart | ||
|
||
Select the tab corresponding to your operating system and run the following commands | ||
to create a ``quickstart.php`` application file in the ``php-quickstart`` directory: | ||
|
||
.. tabs:: | ||
|
||
.. tab:: macOS / Linux | ||
:tabid: create-file-mac-linux | ||
|
||
.. code-block:: bash | ||
|
||
cd php-quickstart | ||
touch quickstart.php | ||
|
||
.. tab:: Windows | ||
:tabid: create-file-windows | ||
|
||
.. code-block:: bash | ||
|
||
cd php-quickstart | ||
type nul > quickstart.php | ||
|
||
.. step:: Install the {+php-library+} | ||
|
||
To install the {+php-library+}, run the following command in your ``php-quickstart`` | ||
directory: | ||
|
||
.. code-block:: bash | ||
|
||
composer require mongodb/mongodb | ||
|
||
After installing the library, include Composer's ``autoload.php`` file by adding the | ||
following code to the top of your ``quickstart.php`` file: | ||
|
||
.. code-block:: php | ||
|
||
<?php | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
After you complete these steps, you have a new project directory, a | ||
new application file, and the library dependencies installed. | ||
|
||
.. include:: /includes/get-started/troubleshoot.rst |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.