Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# @author : kang cahya
# @github : https://github.com/dyazincahya
# ##########################################
# ###################################################################################################
# requirements:
# - REDHAT 6.x
# - sudo access
#
# source:
# - LIBXL : http://www.libxl.com/download
# - PHPEXCEL EXTENSION : https://github.com/iliaal/php_excel
#
# my version:
# - LIBXL : http://www.libxl.com/download/libxl-lin-3.8.2.tar.gz
# - PHPEXCEL EXTENSION : https://github.com/iliaal/php_excel/archive/Excel-1.0.2-PHP7.zip
# ###################################################################################################
TMP_DIR=/tmp
PHP_CONFIG="/opt/lampp/bin/php-config"
LIBXL_PREFIX_PATH="/opt/libxl-"
LIBXL_DIR_NAME="LIBXL"
set -e
x_get_info() {
echo "|"
echo "|"
echo "| HAI $USER,"
echo "| Kita akan memulai instalasi LIBXL dan PHPEXCEL"
echo "| ------------------------------------------------"
echo "| * salin libxl dan php excel ke $TMP_DIR"
echo "| * ubah name folder libxl menjadi LIBXL"
echo "| * ubah nama folder php excel menjadi PHPEXCEL"
echo "| ------------------------------------------------"
echo "|"
echo "|"
echo "| Versi LIBXL? (contoh: 3.8.2)"
read LIBXL_VERSION
echo "| Versi PHPEXCEL? (contoh: 1.0.2)"
read PHPEXCEL_VERSION
}
x_install_libxl() {
echo "Mulai memasang LIBXL {"
echo "Proses instalasi memerlukan SUDO, silahkan masukan kata sandi :)"
sudo mkdir -p $LIBXL_PREFIX_PATH$LIBXL_VERSION
sudo cp -r $TMP_DIR/$LIBXL_DIR_NAME/* $LIBXL_PREFIX_PATH$LIBXL_VERSION
echo "} LIBXL berhasil terpasang :D"
}
x_install_phpexcel_extension() {
echo "Mulai memasang PHPEXCEL EXTENSION {"
cd $TMP_DIR/PHPEXCEL/
/opt/lampp/bin/phpize
if [ `getconf LONG_BIT` = "64" ]
then
echo "Mulai mengkonfigurasi arsitertur 64-bit"
./configure --with-php-config=$PHP_CONFIG --with-libxl-incdir=$LIBXL_PREFIX_PATH$LIBXL_VERSION/include_c/ --with-libxl-libdir=$LIBXL_PREFIX_PATH$LIBXL_VERSION/lib64/ --with-excel=$LIBXL_PREFIX_PATH$LIBXL_VERSION
echo "Selesai mengkonfigurasi arsitertur 64-bit"
else
echo "Mulai mengkonfigurasi arsitertur 32-bit"
./configure --with-php-config=$PHP_CONFIG --with-libxl-incdir=$LIBXL_PREFIX_PATH$LIBXL_VERSION/include_c/ --with-libxl-libdir=$LIBXL_PREFIX_PATH$LIBXL_VERSION/lib/ --with-excel=$LIBXL_PREFIX_PATH$LIBXL_VERSION
echo "Selesai mengkonfigurasi arsitertur 32-bit"
fi
make
#make test
sudo make install
echo "} PHPEXCEL EXTENSION berhasil terpasang :D"
echo " "
echo " "
echo " "
}
x_get_info;
x_install_libxl;
x_install_phpexcel_extension;
echo "| INSTALASI LIBXL dan PHPEXCEL EXTENSION sudah selesai"
echo "|"
echo "| CATATAN KECIL :"
echo "| ++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "| - Tolong tambahkan extension=excel.so pada /opt/lampp/etc/php.ini"
echo "| - Lalu silahkan restart lampp kamu, jalankan perintah ini /opt/lampp/lampp restart"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.