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

相关推荐
2401_887724504 分钟前
在 Ubuntu Core 上部署 Go Web 服务的完整实践指南
jvm·数据库·python
Polar__Star8 分钟前
C#怎么实现Redis分布式缓存 C#如何在ASP.NET Core中集成Redis实现分布式缓存方案【架构】
jvm·数据库·python
qq_2069013913 分钟前
如何在 WordPress 中通过邮箱获取用户 ID(PHP 实现)
jvm·数据库·python
ycjunhua17 分钟前
windows 安装PostgreSQL 数据库
数据库·windows·postgresql
liliangcsdn20 分钟前
多轮对话长上下文-增量摘要和结构化摘要示例
服务器·数据库·microsoft
NineData25 分钟前
NineData 5.0 产品发布和生态伙伴大会,圆满举办!
运维·数据库·人工智能
Chasing__Dreams38 分钟前
Mysql--基础知识点--110--select ... lock in share mode VS select ... for share
数据库·mysql
aXin_ya41 分钟前
Redis 网络模型 内存回收
数据库·redis·缓存
一 乐1 小时前
咖啡商城|基于springboot + vue咖啡商城系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·咖啡商城系统
画堂秋1 小时前
网站爬取实例操作
数据库·爬虫