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

相关推荐
6+h2 分钟前
【java IO】IO体系结构 + File类详解
java·数据库·php
happymaker06264 分钟前
JDBC(MySQL)——DAY05(DAO设计模式,JDBC事务处理,阿帕奇工具类)
数据库·mysql·设计模式
2401_891482176 分钟前
用Python批量处理Excel和CSV文件
jvm·数据库·python
m0_743297426 分钟前
使用Flask快速搭建轻量级Web应用
jvm·数据库·python
小年糕是糕手6 分钟前
【35天从0开始备战蓝桥杯 -- 补充包】
开发语言·前端·数据结构·数据库·c++·算法·蓝桥杯
Navicat中国7 分钟前
构建韧性数据库架构
数据库·数据库架构·navicat
kyrie学java8 分钟前
基于 Redis 的分布式登录系统实现总结
数据库·redis·分布式
salipopl10 分钟前
mysql数据被误删的恢复方案
数据库·mysql
数据知道15 分钟前
MongoDB大数据文档设计:处理超过16MB文档的实用策略
数据库·mongodb
悦数图数据库2 小时前
图数据库如何重塑行业智能决策 | 破局金融数据关联困局 悦数图数据库
数据库·金融