Tuesday, August 15, 2017

Mongodb integration with PHP

In my CentOs box, i installed php5.5 and mongodb. Now i am getting the error
Mongodb is not enabled with PHP.

Solution to fix the issue.

Install gcc php-pear php-devel
yum install gcc php-pear php-devel php5-dev openssl-devel -y 

pecl install mongo
Cyrus SASL as "no"

vim /etc/php.ini
extension=mongo.so

Restart apache
service httpd restart

Verify
php -m | grep -i mongo

 
 

323 packages excluded due to repository priority protections

When I run "yum update php*" operation, in CentOs i am getting the following error:

"323 packages excluded due to repository priority protections"

Solution to fix the issue:

This is because of the plugin "priorities" helps to solve this issue. Open the file
/etc/yum/pluginconf.d/priorities.conf  and change the value of enabled =1 to 0.

Execute  yum update php*

It works.

Thursday, August 10, 2017

jq - How we can use jq

jq - JSON processor. We can use this to parse a JSON file in bash scripts. Its an opensource and available in github. We can use this like our sed, awk and grep.

How we can install jq on Centos machine?

jq has no runtime dependencies as its written in C. We need to download and extract to use it. You can play around with jq from here.

wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x ./jq
cp jq /usr/bin