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

相关推荐
noravinsc36 分钟前
connection.cursor() 与 models.objects.filter
数据库·django·原生查询·orm查询
laimaxgg2 小时前
MySQL复合查询
数据库·mysql
编程在手天下我有3 小时前
Redis 常见问题深度剖析与全方位解决方案指南
数据库·redis·缓存·性能优化·数据持久化·分布式系统
辰哥单片机设计3 小时前
JQ6500语音模块详解(STM32)
数据库·mongodb
阿桨4 小时前
【保姆级教程-Centos7环境下部署mongodb并设置开机自启】
数据库·mongodb·centos
lolo大魔王4 小时前
MongoDB的增删改查操作
数据库·mongodb
layman05285 小时前
node.js 实战——mongoDB
数据库·mongodb·node.js
爱可生开源社区6 小时前
SQLShift 全新上线:Oracle→OceanBase 迁移利器
数据库
wkj0016 小时前
java 和 C#操作数据库对比
java·数据库·c#
编程在手天下我有7 小时前
Redis 数据类型全览:特性、场景与操作实例
数据库·redis·数据结构与算法