宝塔php8.3安装MongoDB扩展

Step 1: Download the MongoDB Extension

Use wget to download the MongoDB extension package version 1.20.1 from PECL:

php 复制代码
wget -O mongodb-1.20.1.tgz https://pecl.php.net/get/mongodb-1.20.1.tgz --no-check-certificate

Step 2: Extract the Tarball

After downloading, extract the tarball using tar:

php 复制代码
tar xvf mongodb-1.20.1.tgz

Step 3: Enter the MongoDB Extension Directory

Navigate into the extracted directory:

php 复制代码
cd mongodb-1.20.1

Step 4: Prepare PHP for Extension Installation

Run phpize to prepare PHP for the extension:

php 复制代码
/www/server/php/83/bin/phpize

This command prepares the PHP environment to compile the extension.

Step 5: Configure the Extension

Configure the installation path and PHP settings:

php 复制代码
./configure --with-php-config=/www/server/php/83/bin/php-config

This step ensures that the extension will be compatible with your PHP installation.

Step 6: Compile the Extension

Run the make command to compile the extension:

php 复制代码
make

This compiles the MongoDB extension for PHP.

Step 7: Install the Extension

Install the compiled extension:

php 复制代码
make install

This installs the mongodb.so file into the appropriate directory for PHP extensions.

Step 8: Clean Up

After the installation, remove the extracted files to clean up:

php 复制代码
cd ..
rm -rf mongodb-1.20.1*

This command removes the mongodb-1.20.1 directory and the downloaded tarball.

Step 9: Restart PHP-FPM

Reload the PHP-FPM service to apply the changes:

php 复制代码
service php-fpm-83 reload

This restarts PHP-FPM with the newly installed MongoDB extension enabled.

相关推荐
q***38511 分钟前
Spring boot启动原理及相关组件
数据库·spring boot·后端
你不是我我32 分钟前
【Java 开发日记】SQL 语句左连接右连接内连接如何使用,区别是什么?
java·javascript·数据库
JELEE.38 分钟前
Django中如何重写save()方法
数据库·django
SuperSpinach43 分钟前
mysql 报错Authentication method ‘caching_sha2_password‘ is not supported.
数据库·mysql
R.lin1 小时前
MySQL 性能优化最佳实践
数据库·mysql·性能优化
北i1 小时前
TiDB 关联子查询去关联优化实战案例与原理深度解析
java·数据库·sql·tidb
清风6666661 小时前
基于单片机的智慧校园自动打铃系统设计
数据库·单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
JIngJaneIL3 小时前
就业|高校就业|基于ssm+vue的高校就业信息系统的设计与实现(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·毕设·高校就业
CXH7283 小时前
nginx-file-server
运维·数据库·nginx
一 乐3 小时前
社区互助|社区交易|基于springboot+vue的社区互助交易系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·小区互助系统