Fix installing ionCube in multiarch, fix installing SourceGuardian for 32-bit PHP (#444)
parent
f81f0cd1a2
commit
cdda8c2bdd
|
@ -74,12 +74,14 @@ setDistro() {
|
|||
# - PHP_MAJMINPAT_VERSION: Major-Minor-Patch version, format MMmmpp (example 80001 for PHP 8.0.1) variables containing integers value
|
||||
# - PHP_MAJDOTMINDOTPAT_VERSION: Major-Minor-Patch version, format M.m.p (example 8.0.1 for PHP 8.0.1)
|
||||
# - PHP_THREADSAFE: 1 if PHP is thread-safe (TS), 0 if not thread-safe (NTS)
|
||||
# - PHP_BITS: 32 if PHP is compiled for 32-bit, 64 if 64-bit
|
||||
setPHPVersionVariables() {
|
||||
PHP_MAJDOTMINDOTPAT_VERSION="$(php-config --version)"
|
||||
PHP_MAJMIN_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | awk -F. '{print $1*100+$2}')
|
||||
PHP_MAJDOTMIN_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | cut -d. -f1-2)
|
||||
PHP_MAJMINPAT_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | awk -F. '{print $1*10000+$2*100+$3}')
|
||||
PHP_THREADSAFE=$(php -r 'echo ZEND_THREAD_SAFE ? 1 : 0;')
|
||||
PHP_BITS=$(php -r 'echo PHP_INT_SIZE * 8;')
|
||||
}
|
||||
|
||||
# Fix apt-get being very slow on Debian Jessie
|
||||
|
@ -1317,17 +1319,20 @@ compareVersions() {
|
|||
# Set:
|
||||
# ORACLE_INSTANTCLIENT_LIBPATH
|
||||
installOracleInstantClient() {
|
||||
if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then
|
||||
case $PHP_BITS in
|
||||
32)
|
||||
installOracleInstantClient_client=client
|
||||
installOracleInstantClient_version='19.9'
|
||||
installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-basic-linux-$installOracleInstantClient_version.0.0.0dbru.zip
|
||||
installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-sdk-linux-$installOracleInstantClient_version.0.0.0dbru.zip
|
||||
else
|
||||
;;
|
||||
*)
|
||||
installOracleInstantClient_client=client64
|
||||
installOracleInstantClient_version='21.1'
|
||||
installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basic-linux.x64-$installOracleInstantClient_version.0.0.0.zip
|
||||
installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sdk-linux.x64-$installOracleInstantClient_version.0.0.0.zip
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
ORACLE_INSTANTCLIENT_LIBPATH=/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib
|
||||
if ! test -e "$ORACLE_INSTANTCLIENT_LIBPATH"; then
|
||||
printf 'Downloading Oracle Instant Client v%s... ' "$installOracleInstantClient_version"
|
||||
|
@ -1354,11 +1359,14 @@ installOracleInstantClient() {
|
|||
cat "$ORACLE_INSTANTCLIENT_LIBPATH" | awk -v suffix=":$ORACLE_INSTANTCLIENT_LIBPATH" '{print NR==1 ? $0suffix : $0}' >"$ORACLE_INSTANTCLIENT_LIBPATH"
|
||||
fi
|
||||
else
|
||||
if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then
|
||||
case $PHP_BITS in
|
||||
32)
|
||||
echo "/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf"
|
||||
else
|
||||
;;
|
||||
*)
|
||||
echo "/lib64:/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
debian)
|
||||
|
@ -1457,12 +1465,47 @@ actuallyInstallComposer() {
|
|||
rm -- "$actuallyInstallComposer_installer"
|
||||
}
|
||||
|
||||
# Install ionCube Loader
|
||||
installIonCubeLoader() {
|
||||
# See https://www.ioncube.com/loaders.php
|
||||
case $PHP_BITS in
|
||||
32)
|
||||
case $(uname -m) in
|
||||
aarch* | arm*)
|
||||
installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz"
|
||||
;;
|
||||
*)
|
||||
installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
case $(uname -m) in
|
||||
aarch64 | arm64 | armv8)
|
||||
installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_aarch64.tar.gz"
|
||||
;;
|
||||
*)
|
||||
installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
printf 'Downloading ionCube Loader... '
|
||||
installIonCubeLoader_dir="$(getPackageSource $installIonCubeLoader_url)"
|
||||
echo 'done.'
|
||||
installIonCubeLoader_so=$(php -r "printf('ioncube_loader_lin_%s.%s%s.so', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, ZEND_THREAD_SAFE ? '_ts' : '');")
|
||||
cp "$installIonCubeLoader_dir/$installIonCubeLoader_so" "$(getPHPExtensionsDir)/ioncube_loader.so"
|
||||
}
|
||||
|
||||
# Install SourceGuardian Loader
|
||||
installSourceGuardian() {
|
||||
case $(uname -m) in
|
||||
i386 | i686 | x86)
|
||||
# See https://www.sourceguardian.com/loaders.html
|
||||
case $PHP_BITS in
|
||||
32)
|
||||
installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-i386.tar.gz
|
||||
;;
|
||||
*)
|
||||
case $(uname -m) in
|
||||
aarch64 | arm64 | armv8)
|
||||
installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-aarch64.tar.gz
|
||||
;;
|
||||
|
@ -1470,6 +1513,8 @@ installSourceGuardian() {
|
|||
installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
printf 'Downloading SourceGuardian... '
|
||||
installSourceGuardian_dir="$(getPackageSource $installSourceGuardian_url)"
|
||||
printf 'done (version: %s)\n' "$(cat "$installSourceGuardian_dir/version")"
|
||||
|
@ -1970,17 +2015,7 @@ installRemoteModule() {
|
|||
fi
|
||||
;;
|
||||
ioncube_loader)
|
||||
installRemoteModule_src='https://downloads.ioncube.com/loader_downloads/'
|
||||
if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then
|
||||
installRemoteModule_src="${installRemoteModule_src}ioncube_loaders_lin_x86.tar.gz"
|
||||
else
|
||||
installRemoteModule_src="${installRemoteModule_src}ioncube_loaders_lin_x86-64.tar.gz"
|
||||
fi
|
||||
printf 'Downloading ionCube Loader... '
|
||||
installRemoteModule_src="$(getPackageSource $installRemoteModule_src)"
|
||||
echo 'done.'
|
||||
installRemoteModule_so=$(php -r "printf('ioncube_loader_lin_%s.%s%s.so', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, ZEND_THREAD_SAFE ? '_ts' : '');")
|
||||
cp "$installRemoteModule_src/$installRemoteModule_so" "$(getPHPExtensionsDir)/$installRemoteModule_module.so"
|
||||
installIonCubeLoader
|
||||
installRemoteModule_manuallyInstalled=1
|
||||
;;
|
||||
jsmin)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/_bootstrap.php';
|
||||
|
||||
$rc = 0;
|
||||
foreach ([false => 'PHP module', true => 'Zend extension'] as $type => $typeName) {
|
||||
$extensions = get_loaded_extensions($type);
|
||||
$found = '';
|
||||
foreach ($extensions as $extension) {
|
||||
if (preg_match('/^(the )?ioncube (php )?loader/i', $extension)) {
|
||||
$found = $extension;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($found !== '') {
|
||||
fwrite(STDOUT, "The {$found} {$typeName} is loaded.\n");
|
||||
} else {
|
||||
fwrite(STDERR, "The ionCube Loader {$typeName} is not loaded.\nLoaded extensions are: \n- " . implode("\n- ", $extensions));
|
||||
$rc = 1;
|
||||
}
|
||||
}
|
||||
exit($rc);
|
Loading…
Reference in New Issue