宝塔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.

相关推荐
木风小助理9 小时前
PostgreSQL基础知识——DDL深度解析
数据库·postgresql
hanqunfeng9 小时前
(四十四)Redis8 新增的数据类型 -- Vector Set
数据库·redis·缓存
梦梦代码精10 小时前
BuildingAI vs Dify vs 扣子:三大开源智能体平台架构风格对比
开发语言·前端·数据库·后端·架构·开源·推荐算法
纪莫11 小时前
技术面:MySQL篇(InnoDB的锁机制)
java·数据库·java面试⑧股
Filotimo_12 小时前
在java开发中,cron表达式概念
java·开发语言·数据库
DBA小马哥12 小时前
从MongoDB迁移到金仓数据库:数据模型与业务连续性难题的保姆级指南
数据库·mongodb·dba
QZ1665609515913 小时前
低误差率、高性能、符合审计要求的金融数据库审计和监测最佳实践指南
数据库·金融
愚公移码13 小时前
蓝凌EKP产品:主文档权限机制浅析
java·前端·数据库·蓝凌
此生只爱蛋13 小时前
【Redis】持久化
数据库·redis
burning_maple14 小时前
redis笔记
数据库·redis·笔记