I have installed LAMPP on Ubuntu 16.04 LTS Server and Mongo DB installed. Now I am trying to install MongoDB driver to PHP.
sudo /opt/lampp/bin/pecl install mongo
It is throwing me the below showing error
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb" downloading mongo-1.6.14.tgz ...
Starting to download mongo-1.6.14.tgz (210,095 bytes)
.............................................done: 210,095 bytes
118 source files, building
running: phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no]:
building in /tmp/pear/temp/pear-build-rootL9IHAe/mongo-1.6.14
running: /tmp/pear/temp/mongo/configure --with-php-config=/opt/lampp
/bin/php-config --with-mongo-sasl=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... no
configure: error: in `/tmp/pear/temp/pear-build-rootL9IHAe/mongo-1.6.14':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: `/tmp/pear/temp/mongo/configure --with-php-config=/opt/lampp
/bin/php-config --with-mongo-sasl=no' failed
But the same command working on Ubuntu 16.04 LTS Client. Unable to fix this even after googling a lot.Looking for Solution!
Я решил эту проблему, установив компилятор Autoconf, devssl и gcc. Мой сервер успешно работает.
sudo apt install gcc
sudo apt-get install autoconf
sudo apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
sudo apt-get install libssl-dev
sudo apt-get install build-essential
Затем я попытался установить расширение mongo на PHP
sudo /opt/lampp/bin/pecl install mongo
Он был успешно скомпилирован и установлен. Позже я добавил mongo расширение в php.ini
echo 'extension=mongo.so' >> /opt/lampp/etc/php.ini
Успешно.
Я использую sudo pecl install mongodb
, и это работает для меня. если вы используете php версии 5.6 и проверяете эти пакеты sudo apt-get install -y autoconf g ++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev