Update PHP Mongo Extension to 1.5 on Ubuntu 14 - php

PHP and Mongo are working correctly however the php5-mongo extension needs updating.
Currently it is version 1.4.5, version 1.5.x is required to be compatible with the latest https://github.com/doctrine/mongodb/
Running does not update the version.
sudo apt-get install php5-mongo
Additional info
mongod --version db version v2.6.12
php --version PHP 5.5.9-1ubuntu4.14
How can the extension be updated? Is pecl required to perform the update?

Try with PECL
sudo pecl install mongodb
Sometime you may get SSL error when connecting to the mongodb so please install dependencies before the pecl installation
sudo pecl channel-update pecl.php.net
sudo pecl uninstall mongodb
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev
sudo pecl install mongodb
You should add "extension=mongodb.so" to php.ini
Verify the MongoDB extension and module by using
sudo php --ri mongodb | grep version
sudo apt-cache policy php-mongodb

Related

How to update Libzip to 1.2 on ubuntu 18.04 and PHP 7.2

I want to use ZipArchive::setEncryptionName on Ubuntu server 18.04.1 with PHP 7.2.7
Problem is that setEncryptionName need Libzip version at least 1.2
default configuration from PHP info:
Zip version 1.15.2
Libzip version 1.1.2
I don't know how to update Libzip on ubuntu server, I don't have this problem on win and mac.
(1) Locate a newer version of libzip and libzip-dev on Launchpad. Currently it's 1.5.1 under The Eoan Ermine (1.7.3 doesn't work any more). Download the correct deb files (libzip-dev_1.5.1-0ubuntu1_amd64.deb and libzip5_1.5.1-0ubuntu1_amd64.deb).
(2) Install them with
sudo dpkg -i libzip-dev_1.5.1-0ubuntu1_amd64.deb libzip5_1.5.1-0ubuntu1_amd64.deb
They may be missing some dependencies, you can try to install them with apt first, so you don't need to download any more "incompatible" packages from Launchpad. Then rerun this command.
(3) Install php-zip. Install PEAR (PECL) to upgrade php-zip to a newer version. Also install php-dev required by PECL to build php-zip.
sudo apt install php-zip php-pear php-dev
(4) Upgrade php-zip to support the newer libzip.
sudo pecl install zip
(5) Probably you don't need the development libraries any more.
sudo apt purge php-dev libzip-dev
sudo apt autoremove --purge
(6) See phpinfo() if you have the correct libzip version. You may need to restart your webserver.
(7) You can prevent apt from automatically upgrading your php-zip, breaking your custom installation. But then you should remember to manually upgrade php with pecl, or check if the newer version supports the newer libzip. (See installed version with sudo dpkg -l | grep php)
sudo apt-mark hold php<installed version>-zip
To get back the original version (assuming you've used libzip5, and you don't need the previously installed packages):
sudo apt-mark unhold php<installed version>-zip
sudo pecl uninstall zip
sudo apt purge php-pear libzip5 php-zip
sudo apt autoremove --purge
sudo apt install php-zip

Install mongodb driver for php 7.1 on RHEL 7.1

I am trying to install mongodb driver for php 7.1 but not found any solution.
Used following command
pecl install mongodb
But gives , pecl command not found. Tried to install pecl by
yum install pecl
But given no package available
Try install php-pear package. pecl is included on it.
P.S. See https://pkgs.org/download/php-pear
You can also use yum packages:
yum install php71-php-pecl-mongodb.x86_64 -y

Install php7.0 mongodb on ubuntu 17.04

I am using Ubuntu 17.04 64 bit
I am trying to install mongodb driver for php7.0
There is no driver for this version.
How can I install it?
Why not, there is driver for it, to install use
sudo apt-get install php-mongodb
do not sepcify any version on the php, like php7. just php-mongodb
You can do a manual install via the pecl extension using
$ sudo pecl install mongodb
for further info, check out this link

How to install all required PHP extensions for Laravel?

I need to make my Ubuntu 16.04. Is there a way using the GUI or is the simplest way to do this by using terminal?
I have already installed PHP 7.1, MariaDB.
I need to enable:
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
The Laravel server requirements specify the PHP extensions, including BCMath, Ctype, cURL, DOM, Fileinfo, JSON, Mbstring, OpenSSL, PCRE, PDO, Tokenizer, and XML, are required. These extensions are usually included and enabled during a PHP installation.
You can use the following command in Ubuntu to check the necessary extensions.
sudo apt install openssl php-bcmath php-curl php-json php-mbstring php-mysql php-tokenizer php-xml php-zip
Installation specific to a particular version of PHP (such as PHP 8.2)
sudo apt install openssl php8.2-bcmath php8.2-curl php8.2-json php8.2-mbstring php8.2-mysql php8.2-tokenizer php8.2-xml php8.2-zip
Additional PHP extensions may require for your composer packages. Refer to the links below for more information.
PHP extensions for Ubuntu 22.04 LTS (Jammy Jellyfish)
PHP extensions for Ubuntu 20.04 LTS (Focal Fossa)
PHP extensions for Ubuntu 18.04 LTS (Bionic)
PHP extensions for Ubuntu 16.04 LTS (Xenial)
**
New requirements for installing Laravel 8 and PHP 8:
**
sudo apt install php8.0-common php8.0-dom php8.0-bcmath openssl php8.0-mbstring
Run the below command. It will install all required php8.1 extensions in Ubuntu
sudo apt install php8.1 php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-bcmath php8.1-fpm php8.1-phpdbg php8.1-cgi libphp8.1-embed libapache2-mod-php8.1
You can install PHP extensions like this:
sudo apt-get install php-xsl php-pgsql
Here is Extension with Name and Commands for UBUNTU
Install or enable PHP's curl extension
sudo apt install phpy-curl
Install or enable PHP's simplexml extension.
sudo apt install php-xml
Install or enable PHP's gd extension
sudo apt-get install php-gd
Install or enable PHP's zip extension
sudo apt install php-zip

uninstall mongodb php driver and install a different version

I'm using Ubuntu Xampp (Lampp) and currently on MongoDB 1.5.3 driver.
I need to downgrade to 1.4.5, but when re-installed the downgraded driver, it does not change in phpinfo(). Yes, I have restarted Apache.
So, how do I uninstall the current one and install the downgraded version?
Update: 2018-06-20:
PECL package mongo is now deprecated, you should use mongodb package instead:
sudo pecl install -f mongodb-1.4.4
Original answer
You can upgrade to a specific version of a driver by using pecl:
sudo pecl install -f mongo-1.4.5
If you get a pecl: command not found error you will need to install PEAR package:
sudo apt-get update && sudo apt-get install php-pear
You can use this command to check that you have the correct version installed:
sudo pecl info mongo
Or you can check php configuration directly with:
php -i | grep -A 1 MongoDB

Categories