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

相关推荐
Kt&Rs34 分钟前
MySQL复制技术的发展历程
数据库·mysql
小小菜鸡ing37 分钟前
pymysql
java·服务器·数据库
手握风云-43 分钟前
MySQL数据库精研之旅第十六期:深度拆解事务核心(上)
数据库·mysql
boonya2 小时前
Redis核心原理与面试问题解析
数据库·redis·面试
沙二原住民2 小时前
提升数据库性能的秘密武器:深入解析慢查询、连接池与Druid监控
java·数据库·oracle
三毛20042 小时前
玳瑁的嵌入式日记D33-0908(SQL数据库)
jvm·数据库·sql
叫我龙翔2 小时前
【MySQL】从零开始了解数据库开发 --- 库的操作
数据库·mysql·数据库开发
没有bug.的程序员2 小时前
Redis Stream:轻量级消息队列深度解析
java·数据库·chrome·redis·消息队列
GottdesKrieges3 小时前
OceanBase容量统计:租户、数据库、表大小
数据库·oceanbase
pan3035074793 小时前
mysql 回表查询(二次查询,如何检查,如何规避)
数据库·mysql