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

相关推荐
老华带你飞5 分钟前
汽车销售|汽车报价|基于Java汽车销售系统(源码+数据库+文档)
java·开发语言·数据库·vue.js·spring boot·后端·汽车
黑客思维者5 分钟前
数据库连接池的并发控制与超时处理:从参数调优到动态适配
数据库
Chloeis Syntax7 分钟前
MySQL初阶学习日记(4)--- 插入、聚合、分组查询 + 数据库约束
数据库·笔记·学习·mysql
西岭千秋雪_16 分钟前
MySQL集群搭建
java·数据库·分布式·mysql
马克学长17 分钟前
SSM实验室预约管理系统5x7en(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面
数据库·实验室预约管理系统·ssm 框架
古城小栈1 小时前
MySQL 配置优化 绿皮书
数据库·mysql
向葭奔赴♡2 小时前
若依数据权限实现全流程解析
数据库
不许赖zhang2 小时前
navicat免安装 navicat12 适配win10、win11
数据库
箬敏伊儿2 小时前
Apple M2 + Docker + MySQL 轻量配置全教程
数据库·mysql·docker
FserSuN2 小时前
mysql8 loose index skip scan 特性加速分组查询性能
数据库·mysql