Skip to content

Commit

Permalink
Support apcu/ioncube for PHP 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bypanelcom committed Oct 7, 2016
1 parent 56ca69a commit b384518
Show file tree
Hide file tree
Showing 24 changed files with 563 additions and 487 deletions.
79 changes: 54 additions & 25 deletions addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
. ./include/color.sh
. ./include/memory.sh
. ./include/check_os.sh
. ./include/check_download.sh
. ./include/download.sh
. ./include/get_char.sh

Expand All @@ -50,8 +51,15 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf

# Check PHP
if [ -e "$php_install_dir/bin/phpize" ];then
PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'`
PHP_main_version=${PHP_version%.*}
PHP_detail_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'`
phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir`
PHP_main_version=${PHP_detail_version%.*}
PHP_yn=y
[ "$PHP_main_version" == '5.3' ] && PHP_version=1
[ "$PHP_main_version" == '5.4' ] && PHP_version=2
[ "$PHP_main_version" == '5.5' ] && PHP_version=3
[ "$PHP_main_version" == '5.6' ] && PHP_version=4
[ "$PHP_main_version" == '7.0' ] && PHP_version=5
fi

# Check PHP Extensions
Expand All @@ -66,7 +74,7 @@ Restart_PHP() {

# Check succ
Check_succ() {
[ -f "`$php_install_dir/bin/php-config --extension-dir`/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; }
[ -f "${phpExtensionDir}/${PHP_extension}.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP $PHP_extension module installed successfully! ${CEND}"; }
}

# Uninstall succ
Expand Down Expand Up @@ -193,6 +201,7 @@ What Are You Doing?
if [ $PHP_cache = 1 ];then
cd $oneinstack_dir/src
if [[ $PHP_main_version =~ ^5.[3-4]$ ]];then
src_url=https://pecl.php.net/get/zendopcache-${zendopcache_version}.tgz && Download_src
Install_ZendOPcache
elif [ "$PHP_main_version" == '5.5' ];then
src_url=https://www.php.net/distributions/php-$php_5_version.tar.gz && Download_src
Expand All @@ -212,28 +221,39 @@ What Are You Doing?
fi
Check_succ
elif [ $PHP_cache = 2 ];then
cd $oneinstack_dir/src
if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then
while :; do
read -p "Please input xcache admin password: " xcache_admin_pass
(( ${#xcache_admin_pass} >= 5 )) && { xcache_admin_md5_pass=`echo -n "$xcache_admin_pass" | md5sum | awk '{print $1}'` ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}"
done
src_url=https://xcache.lighttpd.net/pub/Releases/${xcache_version}/xcache-${xcache_version}.tar.gz && Download_src
Install_XCache
Check_succ
else
echo "${CWARNING}Your php does not support XCache! ${CEND}"; exit 1
fi
elif [ $PHP_cache = 3 ];then
if [[ $PHP_main_version =~ ^5.[3-5]$ ]];then
elif [ ${PHP_cache} = 3 ];then
cd $oneinstack_dir/src
if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]];then
src_url=https://pecl.php.net/get/apcu-${apcu_version}.tgz && Download_src
Install_APCU
Check_succ
elif [[ ${PHP_main_version} =~ ^7.[0-1]$ ]];then
src_url=https://pecl.php.net/get/apcu-${apcu_for_php7_version}.tgz && Download_src
Install_APCU
Check_succ
else
echo "${CWARNING}Your php does not support APCU! ${CEND}"; exit 1
fi
elif [ $PHP_cache = 4 ];then
cd $oneinstack_dir/src
if [ "$PHP_main_version" == '5.3' ];then
src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_version}.tar.bz2 && Download_src
Install_eAccelerator-0-9
Check_succ
elif [ "$PHP_main_version" == '5.4' ];then
src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src
Install_eAccelerator-1-0-dev
Check_succ
else
Expand Down Expand Up @@ -261,25 +281,31 @@ What Are You Doing?
break
fi
done
if [ $ACTION = 1 ];then
Check_PHP_Extension
if [[ $PHP_main_version =~ ^5.[3-6]$ ]];then
if [ $Loader = 1 ];then
if [ -e $php_install_dir/etc/php.d/ext-opcache.ini ];then
echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1
else
Install_ZendGuardLoader
Check_succ
fi
elif [ $Loader = 2 ];then
Install_ionCube
Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}";
fi
if [ ${ACTION} = "1" ];then
Check_PHP_Extension
if [ ${Loader} = "1" ]; then
if [[ ${PHP_main_version} =~ ^5.[3-6]$ ]] || [ "${armPlatform}" != "y" ]; then
if [ -e ${php_install_dir}/etc/php.d/ext-opcache.ini ]; then
echo; echo "${CWARNING}You have to install OpCache, You need to uninstall it before install ZendGuardLoader! ${CEND}"; echo; exit 1
else
ZendGuardLoader_yn=y && checkDownload
Install_ZendGuardLoader
Check_succ
fi
else
echo; echo "${CWARNING}Your php does not support $PHP_extension! ${CEND}";
echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
fi
elif [ ${Loader} = "2" ]; then
if [[ ${PHP_main_version} =~ ^5.[3-6]$|^7.0$ ]] || [ "${TARGET_ARCH}" != "arm64" ]; then
ionCube_yn=y && checkDownload
Install_ionCube
Restart_PHP; echo "${CSUCCESS}PHP ioncube module installed successfully! ${CEND}";
else
echo; echo "${CWARNING}Your php ${PHP_detail_version} or platform ${TARGET_ARCH} does not support ${PHP_extension}! ${CEND}";
fi
fi
else
Uninstall_succ
Uninstall_succ
fi
;;
3)
Expand All @@ -300,6 +326,7 @@ What Are You Doing?
done
if [ $ACTION = 1 ];then
Check_PHP_Extension
Magick_yn=y && checkDownload
if [ $Magick = 1 ];then
[ ! -d "/usr/local/imagemagick" ] && Install_ImageMagick
Install_php-imagick
Expand All @@ -321,9 +348,9 @@ What Are You Doing?
if [ $ACTION = 1 ];then
Check_PHP_Extension
cd $oneinstack_dir/src
src_url=https://www.php.net/distributions/php-$PHP_version.tar.gz && Download_src
tar xzf php-$PHP_version.tar.gz
cd php-$PHP_version/ext/fileinfo
src_url=https://www.php.net/distributions/php-$PHP_detail_version.tar.gz && Download_src
tar xzf php-$PHP_detail_version.tar.gz
cd php-$PHP_detail_version/ext/fileinfo
$php_install_dir/bin/phpize
./configure --with-php-config=$php_install_dir/bin/php-config
make -j ${THREAD} && make install
Expand Down Expand Up @@ -351,6 +378,7 @@ What Are You Doing?
fi
done
if [ $ACTION = 1 ];then
memcached_yn=y && checkDownload
if [ $Memcache = 1 ];then
[ ! -d "$memcached_install_dir/include/memcached" ] && Install_memcached
Check_PHP_Extension
Expand All @@ -367,7 +395,7 @@ What Are You Doing?
Install_php-memcache
PHP_extension=memcached && Check_PHP_Extension
Install_php-memcached
[ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" -a "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; }
[ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; }
fi
else
PHP_extension=memcache && Uninstall_succ
Expand All @@ -378,6 +406,7 @@ What Are You Doing?
6)
ACTION_FUN
PHP_extension=redis
redis_yn=y && checkDownload
if [ $ACTION = 1 ];then
[ ! -d "$redis_install_dir" ] && Install_redis-server
Check_PHP_Extension
Expand Down
1 change: 1 addition & 0 deletions config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ http {
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;

#Gzip Compression
gzip on;
Expand Down
1 change: 1 addition & 0 deletions config/nginx_apache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ http {
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;

#Gzip Compression
gzip on;
Expand Down
1 change: 1 addition & 0 deletions config/nginx_tomcat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ http {
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;

#Gzip Compression
gzip on;
Expand Down
65 changes: 33 additions & 32 deletions include/GraphicsMagick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,44 @@
# https://github.com/lj2007331/oneinstack

Install_GraphicsMagick() {
cd $oneinstack_dir/src
tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz
cd GraphicsMagick-$GraphicsMagick_version
./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
make -j ${THREAD} && make install
cd ..
rm -rf GraphicsMagick-$GraphicsMagick_version
cd ..
pushd $oneinstack_dir/src
tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz
pushd GraphicsMagick-$GraphicsMagick_version
./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
make -j ${THREAD} && make install
popd
rm -rf GraphicsMagick-$GraphicsMagick_version
popd
}

Install_php-gmagick() {
cd $oneinstack_dir/src
if [ -e "$php_install_dir/bin/phpize" ];then
if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
tar xzf gmagick-2.0.4RC1.tgz
cd gmagick-2.0.4RC1
else
tar xzf gmagick-$gmagick_version.tgz
cd gmagick-$gmagick_version
fi
make clean
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$php_install_dir/bin/phpize
./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick
make -j ${THREAD} && make install
cd ..
rm -rf gmagick-$gmagick_version

if [ -f "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ];then
cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF
pushd $oneinstack_dir/src
phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir`
if [ -e "$php_install_dir/bin/phpize" ];then
if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
tar xzf gmagick-2.0.4RC1.tgz
pushd gmagick-2.0.4RC1
else
tar xzf gmagick-$gmagick_version.tgz
pushd gmagick-$gmagick_version
fi
make clean
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$php_install_dir/bin/phpize
./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick
make -j ${THREAD} && make install
popd
rm -rf gmagick-$gmagick_version

if [ -f "${phpExtensionDir}/gmagick.so" ];then
cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF
[gmagick]
extension=gmagick.so
EOF
[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
else
echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}"
[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
else
echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}"
fi
fi
fi
cd ..
popd
}
65 changes: 33 additions & 32 deletions include/ImageMagick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,44 @@
# https://github.com/lj2007331/oneinstack

Install_ImageMagick() {
cd $oneinstack_dir/src
tar xzf ImageMagick-$ImageMagick_version.tar.gz
cd ImageMagick-$ImageMagick_version
./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
make -j ${THREAD} && make install
cd ..
rm -rf ImageMagick-$ImageMagick_version
cd ..
pushd $oneinstack_dir/src
tar xzf ImageMagick-$ImageMagick_version.tar.gz
pushd ImageMagick-$ImageMagick_version
./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
make -j ${THREAD} && make install
popd
rm -rf ImageMagick-$ImageMagick_version
popd
}

Install_php-imagick() {
cd $oneinstack_dir/src
if [ -e "$php_install_dir/bin/phpize" ];then
if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then
tar xzf imagick-${imagick_for_php53_version}.tgz
cd imagick-${imagick_for_php53_version}
else
tar xzf imagick-$imagick_version.tgz
cd imagick-$imagick_version
fi
make clean
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$php_install_dir/bin/phpize
./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick
make -j ${THREAD} && make install
cd ..
rm -rf imagick-$imagick_version

if [ -f "`$php_install_dir/bin/php-config --extension-dir`/imagick.so" ];then
cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF
pushd $oneinstack_dir/src
phpExtensionDir=`$php_install_dir/bin/php-config --extension-dir`
if [ -e "$php_install_dir/bin/phpize" ];then
if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`" == '5.3' ];then
tar xzf imagick-${imagick_for_php53_version}.tgz
pushd imagick-${imagick_for_php53_version}
else
tar xzf imagick-$imagick_version.tgz
pushd imagick-$imagick_version
fi
make clean
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$php_install_dir/bin/phpize
./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick
make -j ${THREAD} && make install
popd
rm -rf imagick-$imagick_version

if [ -f "${phpExtensionDir}/imagick.so" ];then
cat > $php_install_dir/etc/php.d/ext-imagick.ini << EOF
[imagick]
extension=imagick.so
EOF
[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
else
echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}"
[ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
else
echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}"
fi
fi
fi
cd ..
popd
}
Loading

0 comments on commit b384518

Please sign in to comment.