MongoDB php7 driver installation - mongodb

I'm working on an Ubuntu 16 server and I can't seem to get the mongodb driver for php 7 to work. I installed it successfully on my xampp on my windows machine but Ubuntu and php7 seemingly have vast differences.
I did try to install it via pecl install mongodb and used composer to put in the dependencies but it still does not work. I'm using the same php file from my windows Xampp and when I access the page it throws a 500 status code.
Could someone provide a definitive walkthrough on how to install this driver and maybe also how to revert any changes I made using composer and pecl?

Cool even I tried with pecl but didn't work as expected. It work with pecl7 Also, I received this warning along with error, WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb" pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 7.1.8. Also, got 500 Internal server error.
Before that MongoDB php7 driver, I needed the memcache and getting phphize error that I solved using this repo. Then finally I use this low level PHP driver for MongoDB.
$ git clone https://github.com/mongodb/mongo-php-driver.git
$ cd mongo-php-driver
$ git submodule sync && git submodule update --init
$ /usr/bin/phpize
$ ./configure
$ make all -j 5
$ sudo make install
You can confirm from the output that mongodb.so driver is installed.
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
extension=mongodb.so
Then only step remaining is make it available in your respective path. You can check your extensions_dir in php.ini with the following command,
$ php -i | grep extension_dir
extension_dir => /usr/lib64/php/7.0/modules => /usr/lib64/php/7.0/modules
And, I can verify that mongodb.so is present into the above directory. Then reload the composer and you are good to go ! Hope this helps as it work for me.

Related

error: SERVER does not appear in AM_CONDITIONAL

I am trying to install Lustre on CentOS 7. I followed this link. When I try to run sh ./autogen.sh to generate the configure script I get the above error as illustrated below.
[root#localhost lustre-release]# sh ./autogen.sh
configure.ac:10: installing 'config/config.guess'
configure.ac:10: installing 'config/config.sub'
configure.ac:12: installing 'config/install-sh'
configure.ac:12: installing 'config/missing'
autoMakefile.am:127: error: SERVER does not appear in AM_CONDITIONAL
libcfs/libcfs/autoMakefile.am: installing 'config/depcomp'
Does anyone know how I can resolve this?
To build lustre from git use "autogen.sh" in the top level directory to setup the build environment:
$ bash autogen.sh
libcfs/libcfs/autoMakefile.am: installing 'config/depcomp'
$
Did you try downloading a pre-built package from https://downloads.whamcloud.com/public/lustre/ ? That is usually the easiest compared to building your own.
If you want to build your own Lustre code, which version of the source are you using? The latest code is available at git.whamcloud.com. Most users should use the LTS release (b2_10 branch currently), but if you are doing new development you should use the master branch.

To make things right, you must install php_mongo module

I am not able to install the php mongo driver in a VPS. I've followed this and this documentantion
I checked this stack here but i can't figure out what I am doing wrong.
The VPS runs on PLESK 12 and CentOS 7.
lets say that I have the domain "mydomain.com" on my plesk and in mydomain.com/info.php a phpinfo script.
PHP INFO
PHP.ini
What amb I doing wrong?
The weird thing is that when I run the command "php -v" I get this output:
Which is not the version that is showing phpInfo.
Finally, I can't install the newest driver versions using pecl because I get the following error:
I would appreciate any help
Thanks!!
It's happens because you are call native OS binaries of php and pecl.
Plesk's PHP 5.6 binaries are stored in /opt/plesk/php/5.6/bin/. So you have to call /opt/plesk/php/5.6/bin/php and /opt/plesk/php/5.6/bin/pecl
Here full steps how to install mongodb for PHP 5.6:
[root#cos71x64-plesk12 ~]# /opt/plesk/php/5.6/bin/pecl install mongodb
/opt/plesk/php/5.6/bin/phpize not found. Run 'yum install plesk-php56-devel' to install it
[root#cos71x64-plesk12 ~]# yum install plesk-php56-devel
[root#cos71x64-plesk12 ~]# /opt/plesk/php/5.6/bin/pecl install mongodb
Build process completed successfully
Installing '/opt/plesk/php/5.6/lib64/php/modules/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.1.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongodb.so" to php.ini
[root#cos71x64-plesk12 ~]# echo "extension=mongodb.so" > /opt/plesk/php/5.6/etc/php.d/mongodb.ini
[root#cos71x64-plesk12 ~]# /opt/plesk/php/5.6/bin/php --info | grep mongo
/opt/plesk/php/5.6/etc/php.d/mongodb.ini,
mongodb
mongodb support => enabled
mongodb version => 1.1.4
mongodb stability => stable
libmongoc version => 1.3.3
mongodb.debug => no value => no value

Vagrant cannot install nokogiri-dependent plugins

I'm trying to install the rackspace plugin for vagrant (1.5.1):
vagrant plugin install vagrant-rackspace
But it complains
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.1), and Bundler
cannot continue. Make sure that gem install nokogiri -v '1.6.1'
succeeds before bundling.
However gem install nokogiri -v '1.6.1' and /Applications/Vagrant/embedded/bin/gem install nokogiri -v '1.6.1' both work.
I've looked at a bunch of SO threads and blog posts. Things I've tried that have not worked
Running xcode-select --install
Installing full xcode
brew install gcc-4.2
Remove rvm and rvm version of ruby
Install nokogiri w/ built-in (mac) ruby and vagrant-embedded ruby
Despite the fact that nokogiri installs fine (#5 above) without sudo on both counts, vagrant plugin install vagrant-rackspace still fails...
So, in summary, I can install the nokogiri plugin, however I cannot install the vagrant rackspace plugin, can you help me get the plugin installed?
Related threads
Error to install Nokogiri on OSX 10.9 Maverick?
nokogiri - ERROR: Failed to build gem native extension
Full output of vagrant plugin install vagrant-rackspace --debug
I'm on OSX Mavericks and this worked for me:
Set as environment property:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1
Then install as usual:
vagrant plugin install vagrant-rackspace
Vagrant ships with embedded Ruby and isolated gem environment. So installing gems manually to your "normal" gem environment won't help.
The first issue is that you should never use sudo to run any vagrant command. If possible, please remove ~/.vagrant.d/ or at least chown it recursively back to your own user. You could also try upgrading Vagrant to v1.5.1.
Then please gist/pastebin the output of vagrant plugin install vagrant-rackspace --debug and ~/.vagrant.d/gems/gems/nokogiri-1.6.1/ext/nokogiri/mkmf.log.
The posted solutions didn't work for me. Instead I needed to specify the libxml2, libxslt and libiconv that I installed with homebrew (Do this first).
I installed the gem manually with the embedded ruby with the following [very concise] command line:
/Applications/Vagrant/embedded/bin/gem install \ # select the embedded ruby
--install-dir ~/.vagrant.d/gems \ # install to the vagrant dir
nokogiri -v '1.6.2.1' -- \ # pass options to nokogiri install
--with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 \
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 \
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include \
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
This worked for me on Mavericks and Vagrant 1.6.1:
CC=/usr/bin/gcc vagrant plugin install vagrant-rackspace
I tried NOKOGIRI_USE_SYSTEM_LIBRARIES=1 but got an error saying that system libxml2 is too old.
Warning: This is a super-hacky solution, though it's hard to call it that.
Yesterday I installed Vagrant on another OSX Mavericks box. Like many other posts I read on SO "all I had to do" was run xcode-select --install and bingo vagrant plugin install vagrant-rackspace worked like a charm.
Today I was mired down in the Bundler code again when it dawned on me that since this is an isolated ruby environment why not nuke my ~/.vagrant.d directory and copy the same directory from the successful build on the other box...
The result? A working vagrant rackspace on my laptop! I'm not sure I'll ever figure out what was really wrong, but if anyone wants a shot at the 100 point bounty, I'm still open to suggestions!
In my case the nokogiri folders and their files located in ~/vagrant.d/gems/gems had wrong rights (user/group).
After changing them to username:staff (username being your console user name), it works like a charm.
Similarly with my case, I have an issue while installing vagrant-omnibus plugin for Vagrant 1.6.3 on OSX Mavericks 10.9.4 and ruby 2.0.0p247 rbenv.
I tried setting the env NOKOGIRI_USE_SYSTEM_LIBRARIES to 1 or true, then update+install but the same error still there.
I found that there is a suggestion in https://github.com/mitchellh/vagrant/issues/3769 to use the specify the baked in nokogiri version and this works for me. So, I also wrote a quick noted for myself to refer this unfortunates issue.
If Nate Murray's solution doesn't work, I found upgrading to a Vagrant version > 1.6.4 fixed the issue (as noted in this Github issue: https://github.com/mitchellh/vagrant/issues/3769)
in my case while trying to install vagrant-parallels, i had to check the Command line tools folder had an error in the naming for some reason. Fixing that allowed nokigiri to work well

Setting up Mesos on CentOS

I tried to install the latest release tarball of Mesos on CentOS 6.4 with no luck. It ended up in all sorts of failures in trying to find jvm & jni bindings. Is there any instructions on how to install Mesos on RHEL or CentOS ?
I couldn't find any instructions around so I thought I would troubleshoot all through my way and thought of documenting it here so it can save your time.
First things first, load your CentOS box with essential build tools to get started
$ sudo yum groupinstall "Development tools"
Get Java and python dependencies installed
$ sudo yum install java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64 python python-devel libcurl libcurl-devel
Get the latest Mesos tarball
$ wget http://mirror.nus.edu.sg/apache/mesos/0.13.0/mesos-0.13.0.tar.gz
$ tar -xzvf mesos-0.13.0.tar.gz
$ cd mesos-0.13.0
Before you can build Mesos, you need to set correct JAVA binding paths
$ export JAVA_HOME=/usr
$ export JAVA_LDFLAGS="-L/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -R/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server -ljvm"
$ export JAVA_CPPFLAGS="-I/usr/lib/jvm/java-1.6.0/include -I/usr/lib/jvm/java-1.6.0/include/linux"
$ export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0/jre/lib/amd64/server:$LD_LIBRARY_PATH
Configure and build it
$ ./configure
$ make
After you have built Mesos, it is advisable that you build and run the tests, this will make sure that what you have installed meets all the requirements
$ make check
If the checks are successful, You are just one step away from installing it in your system installation paths
$ make install
To learn how to use Mesos , go here http://mesos.apache.org/gettingstarted/
For those who prefer installing from RPM's, here is a link to a number of different releases for different Linux flavors: http://mesosphere.io/downloads/ For example, for Centos64:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.rpm
sudo rpm -Uvh mesos_0.14.2_x86_64.rpm
I also had to set my LD_LIBRARY_PATH, though to a slightly different value. Check yours.
Python bindings can also be downloaded from the first link above:
wget http://downloads.mesosphere.io/master/centos/6/mesos_0.14.2_x86_64.egg
sudo easy_install mesos_0.14.2_x86_64.egg

MongoDB SpiderMonkey doesn't understand UTF-8

If I add non-ASCII characters to MongoDB database then all db.find() fail telling "non ascii character detected".
It's problem of SpiderMonkey, I have to rebuild it with UTF-8 support.
I've tried to do it like in
http://www.mongodb.org/display/DOCS/Building+Spider+Monkey
but it doesn't work (SpiderMonkey is not installed after I've completed all steps).
I've got Ubuntu 11.04. Does anybody have instruction how to make it work there?
Working instruction how to make work MongoDB with Google V8 can also help.
I'm using MongoDB on Ubuntu Server 11.04, installed it after making fresh OS install using this instruction: http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
Everything is working fine out of the box. Is it critical for you to build MongoDB from scratch?
Using the 10gen-published packages works fine, but if you actually want to compile SpiderMonkey from source with UFT-8 support:
curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xvzf js185-1.0.0.tar.gz
cd js-1.8.5/js/src
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
export CXXFLAGS="-DJS_C_STRINGS_ARE_UTF8"
And then follow the instructions from https://developer.mozilla.org/En/SpiderMonkey/Build_Documentation
autoconf-2.13
./configure
make
make install
cp js /usr/local/bin/
This will install into /usr/local/lib, however the mongodb package looks for it in /usr/lib (where the spidermonkey package is installed). So, we link all files installed to /usr/local /lib from /usr/lib
ln -s /usr/local/lib/libmozjs185.so /usr/lib/libmozjs185.so
ln -s /usr/local/lib/libmozjs185.so.1.0 /usr/lib/libmozjs185.so.1.0
ln -s /usr/local/lib/libmozjs185.so.1.0.0 /usr/lib/libmozjs185.so.1.0.0
ln -s /usr/local/lib/libmozjs185-1.0.a /usr/lib/libmozjs185-1.0.a
Of course you could just move them into /usr/lib instead of symlinking, but I wanted to keep the utf-enabled libs away from the default location, to prevent conflicts with the default spidermonkey package. Without the libmozjs package installed, apt complains that dependencies for mongodb are not satisfied, so I've left it installed.
Keep in mind that if the spidermonkey package gets upgraded, it can overwrite the symlinks to our new libs (or the libs themselves if you've moved them to /usr/local/lib). The ideal solution would be to build your own package to solve dependency issues for good.