Install Legacy Version of PHP Driver for MongoDB on Amazon Linux - php

I am attempting to install Learning Locker on an Amazon Linux site on AWS. I have been following the step-by-step directions on this site, which has been helpful till now. Unfortunately now I am stuck.
Learning Locker requires the older version of the Mongo driver (mongo.so) for PHP. I think this is the latest version. However if I try to install the driver using pecl it will either install the new version of the driver (mongodb.so) or if I specific "pecl install mongo" I get an error that this version is depreciated.
At this point I need to:
Uninstall the mongodb.so driver that is installed currently.
Install the legacy mongo.so driver.
I have searched the Internet but I have not found what I need to know how to uninstall the existing driver and install the legacy driver.
Suggestions? Any insight will be appreciated. Thanks!!!

With more research I was able to learn how to install an older driver with pecl.
pecl search mongo
Retrieving data...0%
.Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
mongo 1.6.14 (stable) 1.6.14 MongoDB database driver
mongodb 1.2.8 (stable) 1.2.7 MongoDB driver for PHP
sudo pecl install mongo-1.6.14
This worked and I was able to run Composer to install Learning Locker.
I still need to uninstall mongodb.so but that is a work in progress.

Related

Installing Mongodb PHP Drivers on Ubuntu 18.04

I have installed mongodb on a new Ubuntu 18.04 server. I can access and work with the database through the command line, but cannot access it via PHP, and was wondering how other people have gotten it to work.
Following a new build of Ubuntu 18.04, and installation of LAMP, I ran:
sudo apt install mongodb-server php-pear php7.2-dev
sudo pecl install mongodb
I then added the mongodb.so extension to the php.ini file, and a phpinfo(); page shows mongodb as installed. So far so good.
If I browse to a test php page ($mongo=new Mongo();), the page fails to load though.
Through web searches, I find the https://github.com/alcaeus/mongo-php-adapter page come up a lot, and I have run the composer installation command there, but to no avail.
Installed versions are: Ubuntu 18.04.2 LTS; mongoDBv3.6.3; php 7.2.17; Apache 2.4.29
I was wondering what steps other people who have gotten PHP to work successfully with Mongodb have followed? I plan to scrap this server and start from a fresh VM install again.
I was able to install php-mongodb after adding the ppa repository ondrej/php:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install php-mongodb
try:
sudo apt-get install php-mongodb
worked for me
It appears that you're attempting to use the Mongo class from the legacy driver, but you're using the non-legacy driver so that class doesn't exist. Please look at the documentation for the updated version of the driver here. You might also consider using the MongoDB PHP Library to abstract away many of the driver calls.
Please note that there are also compatibility considerations between your versions of the PHP library, MongoDB, and the MongoDB PHP driver. You can find the compatibility information for them here.

Trouble installing mssql extensions for PHP

We're using a MSSQL db at work and I want to be able to write PHP scripts that fetches data directly from the db to my local MAMP environment. I've tried installing pdo_sqlsrv and sqlsrv using Homebrew and I've tried compiling the extensions on my own using PECL commands, but in both cases it has ended unsuccessfully with the error message:
fatal error: 'sql.h' file not found
I've been googling this problem all day and can't seem to find a solution that I can get to work/understand. I'd be grateful for any help or hints.
Computer: Macbook Pro 2018 (macOS 10.13.6)
Local environment: MAMP PRO 4.5 (PHP version: 7.2.1)
I found the solution here: https://github.com/Microsoft/msphpsql/issues/198
I was missing tools provided by unixodbc, so:
brew install unixodbc
...provided the .h file(s) I was missing. The PECL installer was then able to locate the required libraries. In case it wouldn't have worked, I would have tried:
sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install pdo_sqlsrv
sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install sqlsrv
...as suggested in the link.

Unable to install memcached via homebrew due to deprecation. PECL doesn't work either

So our friends at Homebrew have gone and changed things. They've deprecated Homebrew/PHP. That's fine, that's what we developers do. I was able to successfully install PHP 5.6 using Homebrew on a fresh installation of OS X High Sierra. I'm trying now to install memcached and mcrypt, but with the Homebrew change I understand this needs to be done through Pear/PECL. However when I trying to use PECL, I get the following error message:
$ sudo pecl install memcached
pecl/memcached requires PHP (version >= 7.0.0), installed version is 5.6.36
I'm wondering now what my options are. I need to stay with PHP 5.6 for now because that's what I need to code against until I can get our stuff up to PHP 7.x.
I'm going to go with Docker. I'm learning it now and it is a breath of fresh air. I'm certain it will work.

The MongoDB PECL extension has not been installed or enabled php7.0 codeigniter cimongo library ubuntu16.04

I am trying to use CIMongo Library for codeigniter to use php and mongo
But I am getting err:The MongoDB PECL extension has not been installed or enabled
But I installed everything correctly
- pecl install mongodb
apt-get install php-mongodb
Will be greatful for any help
Thanks in advance
For the windows users who end up here after googling "The MongoDB PECL extension has not been installed or enabled". (May be other OS users having the same issue also can grab some clues from here):
First of all thanks simon for his answer here
Previous codeigniter versions used the php_mongo.dll (mongo pecl) which you can download from here
Below is how earlier versions check for the existence of the Mongo extension.
if(!class_exists('Mongo'))
{
$this->_show_error('The MongoDB PECL extension has not been installed or enabled', 500);
}
But newer codeigniter version looks for php_mongodb.dll (mongodb pecl) which is you can download from here
Below is how newer versions check for the existence of the Mongo extension.
if (!class_exists('MongoDB\Driver\Manager')) {
show_error("The MongoDB PECL extension has not been installed or enabled", 500);
}
i had also got this error..
I use Bellow sollution, that works for me.
https://servertroubles.blogspot.in/2012/05/configuring-mongodb-from-php-and-xampp.html?showComment=1475216457950#c4755324682340768979

Installing pdo_mysql on Amazon EC2 with PHP 5.5

I've created an Amazon Linux AMI 2013.09.02 server and installed the following:
yum install php55 php55-mbstring php55-soap php55-gd php55-mcrypt php55-pdo httpd24
Apache and PHP work fine. But I need pdo_mysql.so for a legacy version of Doctrine (1.x). I cannot find out how to get pdo_mysql.so onto this system. That file is not within the /user/lib64/php/5.5/modules/ folder.
Suggestions?
Install the package php55-mysqlnd. I believe this will provide mysql support to PDO.
Edit:
For PHP 5.6 support, the package is php56-mysqlnd.
For PHP 7.0 support, the package is php70-mysqlnd.
For PHP 7.1 support, the package is php71-mysqlnd.

Categories