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

相关推荐
派可数据BI可视化24 分钟前
商业智能BI 浅谈数据孤岛和数据分析的发展
大数据·数据库·数据仓库·信息可视化·数据挖掘·数据分析
yong999026 分钟前
C#驱动斑马打印机实现包装自动打印
java·数据库·c#
野犬寒鸦1 小时前
从零起步学习MySQL || 第五章:select语句的执行过程是怎么样的?(结合源码深度解析)
java·服务器·数据库·后端·mysql·adb
QT 小鲜肉1 小时前
【个人成长笔记】Qt 中 SkipEmptyParts 编译错误解决方案及版本兼容性指南
数据库·c++·笔记·qt·学习·学习方法
我是苏苏2 小时前
C#高级:数据库中使用SQL作分组处理4(LAG() 偏移函数)
数据库
wudl55662 小时前
股票300394(天孚通信)2025年4月20日
数据库
IvorySQL2 小时前
PostgreSQL 18 中国贡献者经验分享:开源参与的四点建议
数据库·postgresql·开源
曾凡宇先生2 小时前
openEuler安装jdk,nginx,redis
linux·开发语言·数据库·openeuler
点灯小铭2 小时前
基于单片机的四沟道步进电机玉米补种机设计与实现
数据库·单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
清风6666663 小时前
基于单片机的双机串口通信与数字串存储系统设计
数据库·单片机·mongodb·毕业设计·课程设计·期末大作业