diff --git a/.gp/bash/init-gitpod.sh b/.gp/bash/init-gitpod.sh index 47a3a951..9edb2833 100644 --- a/.gp/bash/init-gitpod.sh +++ b/.gp/bash/init-gitpod.sh @@ -21,6 +21,9 @@ start_spinner "Initializing MySql..." && gp await-port 3306 && stop_spinner $? +# Globals +current_php_version="$(.gp/bash/utils.sh php_version)" + # BEGIN: parse .vscode/settings.json if [[ $(bash .gp/bash/utils.sh parse_ini_value starter.ini development vscode_disable_preview_tab) == 1 ]]; then msg="parsing .vscode/settings.json as per starter.ini" @@ -205,22 +208,26 @@ if [ ! -d "$GITPOD_REPO_ROOT/vendor" ]; then # Install https://www.ioncube.com/loaders.php installed_ioncube_gen=$(bash .gp/bash/utils.sh parse_ini_value starter.ini ioncube install) - if [ "$installed_ioncube_gen" == 1 ]; then - msg="Installing ioncube loader" - log_silent "$msg" && start_spinner "$msg" \ - && wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O /tmp/ioncube.tar.gz \ - && tar xzf /tmp/ioncube.tar.gz -C /tmp \ - && sudo cp /tmp/ioncube/ioncube_loader_lin_7.4.so /usr/lib/php/20190902/ioncube_loader_lin_7.4.so \ - && sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/apache2/conf.d/10-ioncube.ini' \ - && sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/cli/conf.d/10-ioncube.ini' \ - && rm -rf /tmp/ioncube.tar.gz /tmp/ioncube - err_code=$? - if [[ $err_code != 0 ]]; then - stop_spinner $err_code - log -e "ERROR: $msg" + if [[ $installed_ioncube_gen == 1 ]]; then + if [[ $(bash .gp/bash/utils.sh comp_ver_lt "$current_php_version" 7.4) == 0 ]]; then + msg="Installing ioncube loader" + log_silent "$msg" && start_spinner "$msg" \ + && wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O /tmp/ioncube.tar.gz \ + && tar xzf /tmp/ioncube.tar.gz -C /tmp \ + && sudo cp /tmp/ioncube/ioncube_loader_lin_7.4.so /usr/lib/php/20190902/ioncube_loader_lin_7.4.so \ + && sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/apache2/conf.d/10-ioncube.ini' \ + && sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/cli/conf.d/10-ioncube.ini' \ + && rm -rf /tmp/ioncube.tar.gz /tmp/ioncube + err_code=$? + if [[ $err_code != 0 ]]; then + stop_spinner $err_code + log -e "ERROR: $msg" + else + stop_spinner $err_code + log "SUCCESS: $msg" + fi else - stop_spinner $err_code - log "SUCCESS: $msg" + log -e "WARNING: ioncube loader does not support PHP 8+. Installation skipped. Fix your starter.ini" fi fi diff --git a/.gp/bash/php.sh b/.gp/bash/php.sh index 16efee22..e3cd055e 100644 --- a/.gp/bash/php.sh +++ b/.gp/bash/php.sh @@ -118,7 +118,7 @@ keep_existing_php() { echo "END: php.sh" | tee -a $log && exit 1 - msg1=" Using the existing 'latest' version of PHP ($latest_php) as specified in $gp_php_url" && + msg1=" Using the existing 'gitpodlatest' version of PHP ($latest_php) as specified in $gp_php_url" && echo "$msg1" && generate_php_fpm_conf && echo "END: php.sh" | tee -a $log && @@ -139,13 +139,13 @@ echo "BEGIN: php.sh" | tee -a $log php_version=$(. /tmp/utils.sh parse_ini_value /tmp/starter.ini PHP version) ec=$? if [[ $ec -ne 0 ]]; then - 2>&1 echo " WARNING: could not parse /tmp/starter.ini. Defaulting PHP version to 'latest' as specified in $gp_php_url" | tee -a $log - php_version='latest' + 2>&1 echo " WARNING: could not parse /tmp/starter.ini. Defaulting PHP version to 'gitpodlatest' as specified in $gp_php_url" | tee -a $log + php_version='gitpodlatest' fi if [[ $php_version == '7.4' ]]; then IFS=" " read -r -a all_packages <<< "$php7_4" -elif [[ $php_version == 'latest' ]]; then +elif [[ $php_version == 'gitpodlatest' ]]; then keep_existing_php else keep_existing_php 'fallback' diff --git a/starter.ini b/starter.ini index 2bcc6026..6940e032 100644 --- a/starter.ini +++ b/starter.ini @@ -32,10 +32,10 @@ vscode_disable_preview_tab=1 type=laravel-js-2space [PHP] -# version, valid values are 7.4 and latest. -# The value 'latest' will install the version of php set in +# version, valid values are 7.4 and gitpodlatest. +# The value 'gitpodlatest' will install the version of php set in # https://github.com/gitpod-io/workspace-images/blob/master/full/Dockerfile -# Invalid values will default to 'latest' +# Invalid values will default to 'gitpodlatest' version=7.4 # ppa, valid values are OS and ondrej # The value 'OS' will use the standard (default) operating system PPA