At this moment, php-mongodb support PHP7.2 for Laravel. You need to change PHP-cli to 7.2 (my server use OpenLiteSpeed):
rm -f /usr/bin/php && ln -s /usr/local/lsws/lsphp72/bin/php /usr/bin/php
Depend on your server OS, your commands like as:
dnf install re2c
dnf install lsphp72-devel make gcc glibc-devel zlib-devel
/usr/local/lsws/lsphp72/bin/pecl install mongodb
chmod 755 /usr/local/lsws/lsphp72/lib64/php/modules/mongodb.so
Add “extension=mongodb.so” to php72 config (php.ini). Restart your php server:
For OpenLiteSpeed: systemctl restart lsws
In your project folder, run:
composer install
composer update
php artisan key:generate
php optimize