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

相关推荐
阿里云大数据AI技术16 分钟前
OpenSearch 视频 RAG 实践
数据库·人工智能·llm
m0_623955662 小时前
Oracle使用SQL一次性向表中插入多行数据
数据库·sql·oracle
阿蒙Amon3 小时前
C#读写文件:多种方式详解
开发语言·数据库·c#
东窗西篱梦3 小时前
Redis集群部署指南:高可用与分布式实践
数据库·redis·分布式
就是有点傻4 小时前
C#如何实现中英文快速切换
数据库·c#
1024小神5 小时前
hono框架绑定cloudflare的d1数据库操作步骤
数据库
KellenKellenHao6 小时前
MySQL数据库主从复制
数据库·mysql
@ chen7 小时前
Redis事务机制
数据库·redis
KaiwuDB7 小时前
使用Docker实现KWDB数据库的快速部署与配置
数据库·docker
一只fish7 小时前
MySQL 8.0 OCP 1Z0-908 题目解析(16)
数据库·mysql