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

相关推荐
甜可儿9 分钟前
redis序列化设置
数据库·redis
GGBondlctrl14 分钟前
【SpringBoot】论坛项目中如何进行实现发布文章,以及更新对应数据库的数据更新
数据库·springboot项目·三层设计思想·文章发布项目
若云止水28 分钟前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_init_cycle 函数 - 详解(4)
数据库·nginx·ubuntu
jay丿1 小时前
Django模板系统深入
数据库·django·sqlite
千层冷面1 小时前
Redis除了做缓存还能做什么?
数据库·redis·缓存
码有余悸3 小时前
Redis:高性能的键值存储系统
数据库·redis·缓存
剑客狼心7 小时前
Oracle:什么是存储过程
数据库·oracle
小王努力学编程7 小时前
【MySQL篇】表的操作
数据库·mysql
汤汤upup7 小时前
面试八股文--数据库基础知识总结(2) MySQL
数据库·mysql·面试
m0_7482509310 小时前
mysql数据被误删的恢复方案
数据库·mysql