宝塔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 小时前
交叉编译microcom ARM终端串口调试工具
数据库
xxxibolva11 小时前
SQL 学习
数据库·sql·学习
孪生质数-11 小时前
MySQL主从延迟根因诊断法
数据库·mysql
bLEd RING11 小时前
Redis 设置密码无效问题解决
数据库·redis·缓存
WiChP12 小时前
【V0.1B5】从零开始的2D游戏引擎开发之路
java·服务器·数据库
751158913 小时前
笔记:postgresql如何下载驱动并安装?
数据库·postgresql
荒川之神13 小时前
拉链表概念与基本设计
java·开发语言·数据库
Highcharts.js13 小时前
适合报表系统的可视化图表|Highcharts支持直接导出PNG和PDF
javascript·数据库·react.js·pdf
刘~浪地球13 小时前
Redis 从入门到精通(一):简介、安装与配置
数据库·redis·缓存
APIshop13 小时前
Java获取京东商品详情接口(item_get)实战指南
java·linux·数据库