#!/bin/bash

if [ -f "/var/cpanel/3rdparty/bin/php" ]; then
	echo -n "Found /var/cpanel/3rdparty/bin/php, checking for JSON support"
   if [ "`/var/cpanel/3rdparty/bin/php -m | /bin/grep json`" == "" ]; then
		echo "JSON support missing, attempting to add"
      /var/cpanel/3rdparty/bin/pecl install json
   else
		echo "JSON support found"
	fi
fi

## cPanel's default php location
if [ -f "/usr/local/cpanel/3rdparty/bin/php" ]; then
	echo "Found /usr/local/cpanel/3rdparty/bin/php , checking for JSON support"
   if [ "`/usr/local/cpanel/3rdparty/bin/php -m | /bin/grep json`" == "" ]; then
		echo "JSON support missing, attempting to add"
      /usr/local/cpanel/3rdparty/bin/pecl install json
   else
		echo "JSON support found!"
	fi
fi
