#!/bin/bash
php_ver="7.3"

	echo "[>] Instalacja IonCube"
	echo "[>] Wersja PHP: "
	php -v
		
	cd /tmp
	wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
	tar xfz ioncube_loaders_lin_x86-64.tar.gz
	rm -R /usr/local/ioncube/
	mv ioncube /usr/local/
	rm ioncube_loaders_lin_x86-64.tar.gz
	
	if ! grep -Fxq "zend_extension=/usr/local/ioncube/ioncube_loader_lin_$php_ver.so" /etc/php/$php_ver/apache2/php.ini
	then
		echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_$php_ver.so" >> /etc/php/$php_ver/apache2/php.ini
	fi
	
	if ! grep -Fxq "zend_extension=/usr/local/ioncube/ioncube_loader_lin_$php_ver.so" /etc/php/$php_ver/cli/php.ini
	then
		echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_$php_ver.so" >> /etc/php/$php_ver/cli/php.ini
	fi
	
	service apache2 restart
	php -v