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

相关推荐
星火开发设计16 小时前
模板参数:类型参数与非类型参数的区别
java·开发语言·前端·数据库·c++·算法
山岚的运维笔记16 小时前
SQL Server笔记 -- 第53章:INSERT 第54章:主键
数据库·笔记·sql·microsoft·sqlserver
SQL必知必会16 小时前
SQL 聚合函数详解:COUNT、SUM、AVG、MIN、MAX
数据库·sql
w***298516 小时前
MySQL 创建新用户及授予权限的完整流程
数据库·mysql
heimeiyingwang16 小时前
向量数据库在大模型 RAG 中的核心作用与实践
数据库·人工智能·微服务
weed00016 小时前
MySQL官网驱动下载(jar包驱动和ODBC驱动)【详细教程】
数据库·mysql
青衫码上行17 小时前
Redis新数据类型 - Bitmap、HyperLogLog、Geospatial
数据库·redis·缓存
dc_001217 小时前
MySQL无法连接到本地localhost的解决办法2024.11.8
数据库·mysql·adb
SQL必知必会17 小时前
使用 SQL 实现帕累托原则(80/20 法则)
大数据·数据库·sql
2401_8480097218 小时前
Redis零基础入门学习
数据库·redis·学习