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

相关推荐
c238563 小时前
MySQL 基础用法(上):库表管理与数据增删改
c语言·数据库·c++·mysql
jnrjian4 小时前
postgres database 更换用户
数据库·postgresql
無a伟5 小时前
redis缓存完整详解
数据库·redis·缓存
G31135422736 小时前
大模型不可用时,业务还能不能继续:企业需要设计降级方案
大数据·服务器·数据库·人工智能·深度学习
VALENIAN瓦伦尼安教学设备7 小时前
激光对中仪采购要点
数据库·嵌入式硬件·算法
码农颜7 小时前
5.2.2 隔离级别
数据库·mysql
微三云 - 廖会灵 (私域系统开发)7 小时前
基于 OPC 流程控制的抖店集群 SaaS 平台设计与渠道分账系统实现
数据库
骇客野人8 小时前
MySQL 信创化迁移至 PolarDB-X 整体实施方案
数据库·mysql
计科土狗9 小时前
GESP六级专题之类与对象
java·前端·数据库
麦聪聊数据9 小时前
数据治理 ROI(下):算清投入产出比,小切口落地快速验证价值
数据库