简体   繁体   中英

Install MongoDB PHP Extension for PHP 8.1 (Debian)

sorry if there is a duplicate question for this but I'm trying to set this up for hours now and it just doesn't work.

I have a Debian 11 server with "KeyHelp" installed on it (little brother of plesk). It comes with PHP 7.4 but provides a simple Dashboard where you can install other PHP versions. I installed PHP 8.1 and tried to install the mongodb extension via PECL.

After "pecl install mongodb" I added "extension=mongodb.so" and after that didn't show up the extension on the phpinfo page, I double checked if the extension is really in the extension folder of php, where it was.

Turns out that I installed the extension for PHP 7.4 and not for PHP 8.1. Finally I tried to force PECL to install it for PHP 8.1 but it says "phpize8.1 command not found". I found no way to install phpize8.1, can somebody help me out with that?

Thanks in advance!

If you run command:

sudo apt install php-dev

System will install automatically the correct version of php{x}-dev for your distribution, and all it's dependencies, included PECL.

another way is try to run:

/usr/bin/phpize

If this command works, you need to add phpize to your PATH:

PATH=$PATH\:/usr/bin; export PATH

In this way phpize will work in future.

I am using Ubuntu 20.04
I have PHP 8.1 version. You have to install modules of PHP


List the modules


It's not exactly Debian. I hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM