4 Jul 2014

checking system requirements for owncloud installation

Here a short bash script which checks for all php features required to install owncloud:

#!/usr/bin/env bash

# (>= 5.3.8 minimum, 5.4 or higher recommended)
version=$(php -v | head -n 1 | sed 's/PHP \([0-9.]\+\).*/\1/')
echo "PHP Version $version installed."

# check for the following features:
features="ctype dom GD iconv JSON libxml mbstring SimpleXML zip zlib"

for f in $features; do
 echo -en "Checking: $f";
 r=$(php -i | egrep -i '^'$f'$')
 if [[ "$r" != "" ]]; then 
  echo " ... Found"; 
 else
  echo "";
 fi
done