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

相关推荐
kimi-22221 小时前
在 AutoDL 容器内安装 PostgreSQL + pgvector
数据库·postgresql
番茄去哪了21 小时前
苍穹外卖day07---Redis缓存优化与购物车功能实现
java·数据库·ide·spring boot·spring·maven·mybatis
切糕师学AI21 小时前
MongoDB 是什么?
数据库·mongodb
学历真的很重要21 小时前
【系统架构师】第三章 数据库系统知识 - 数据库基础到关系代数(详细版)
数据库·学习·职场和发展·系统架构·系统架构师
亓才孓21 小时前
【MyBatis Plus】Wrapper接口
java·开发语言·数据库·spring boot·mybatis
nudt_qxx21 小时前
Ubuntu 26.04 LTS“坚毅浣熊”(Resolute Raccoon) 新特性前瞻
linux·数据库·ubuntu
tianzhiyi1989sq1 天前
C++工具库之PugiXML使用指南
java·数据库·c++
人道领域1 天前
MyBatisPlus高效开发实战指南
java·开发语言·数据库
小李独爱秋1 天前
模拟面试:解释一下数据库的主从复制的原理,或者说:怎么做的数据库的数据同步?
数据库·sql·mysql·面试·职场和发展·职场发展
梵克之泪1 天前
一次性查找多个文件,批量文件搜索复制高效方案:咕嘎批量文件查找移动存储系统使用指南,告别手动查找
数据库