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

相关推荐
2301_7796224129 分钟前
mysql如何通过主从备份实现读写分离_配置mysql架构模式
jvm·数据库·python
m0_7411733336 分钟前
HTML5中WebSocket在弱网环境下的延迟抖动算法补偿
jvm·数据库·python
2401_8714928541 分钟前
Pandas如何做时间差对齐_pd.merge_asof按最近的时间戳合并两表
jvm·数据库·python
m0_716255002 小时前
第一部分 数据开发 面试全题 模拟口述版(自问自答)
java·数据库·面试
L-影2 小时前
常见的 ORM 工具
开发语言·数据库·fastapi·orm
噢,我明白了2 小时前
MySQL常用指令--标准的电商/后台管理系统基础结构
数据库·mysql
2403_883261092 小时前
如何用 nodeType 与 nodeName 准确判断当前节点的物理类型
jvm·数据库·python
qq_413502022 小时前
如何利用 Block Tree 避免不必要的子组件重渲染?Vue3 编译黑科技
jvm·数据库·python
彭于晏Yan2 小时前
Spring Boot 聚合MongoDB查询
spring boot·后端·mongodb
丑八怪大丑2 小时前
SQL数据类型
java·数据库·sql