Detailed explanation of the steps to install php-mongodb extension using PECL method

php中世界最好的语言
Release: 2023-03-26 12:52:02
Original
2312 people have browsed it

This time I will bring you the PECL methodInstallationphp-mongodbDetailed explanation of the extension steps, what are the precautions for installing the php-mongodb extension in the PECL method, The following is a practical case, let’s take a look.

Start the installation

The new virtual machine Ubuntu14.04, apache2 and php5 are manually installed; the rest are not.

Then we use one command to install the php extension

sudo pecl install mongodb
Copy after login

At this time, an error will be reported, showing that the dependent package php-pear is missing, then install it, the command is as follows

sudo apt-get install php-pear
Copy after login

When we When we execute the pecl install mongodb command again, we will be prompted that phpize is not an internal command. We need to install php5-dev, and then install the following command:

sudo apt-get install php7.0-dev
Copy after login

When we execute pecl install mongodb again, we should report this error, OpenSSL Library is missing. Then we need to install the following things

apt-get install openssl libssl-dev libssl0.9.8 libgtk2.0-dev
Copy after login

When we execute pecl install mongodb again, the hard work pays off and the installation is finally successful, but in the end we are prompted that we need to manually add the mongodb extension in the php.ini file. as the picture shows.

Finally we open vim /etc/php5/apache2/php.ini and add a line of code like this.

# /etc/php5/apache2/php.ini
extension=mongodb.so
Copy after login

In the end, this effect will be displayed.

Similar to redis, pecl install redis

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website !

Recommended reading:

Detailed explanation of the steps for PHP RSA to generate a key with 1024 bits

PHP development api interface security Detailed explanation of verification steps

The above is the detailed content of Detailed explanation of the steps to install php-mongodb extension using PECL method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!