Skip to content

Commit

Permalink
🐛 FIX: #156
Browse files Browse the repository at this point in the history
  • Loading branch information
apolopena committed Jan 22, 2022
1 parent b7803c4 commit 323b18f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
37 changes: 22 additions & 15 deletions .gp/bash/init-gitpod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

This comment has been minimized.

Copy link
@strausmann

strausmann Jan 22, 2022

Contributor

@apolopena

Shouldn't this be (== 1) ?

This comment has been minimized.

Copy link
@apolopena

apolopena Jan 23, 2022

Author Owner

yeah I think so now that you mention it.

This comment has been minimized.

Copy link
@apolopena

apolopena Jan 23, 2022

Author Owner

Or this:

[[ $(bash .gp/bash/utils.sh comp_ver_lt "$current_php_version" "8.0") == 0 ]]

This comment has been minimized.

Copy link
@strausmann

strausmann Jan 23, 2022

Contributor

Well actually yes at the moment If 7.4 !

Otherwise it should be PHP 8 or greater.

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

Expand Down
8 changes: 4 additions & 4 deletions .gp/bash/php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions starter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 323b18f

Please sign in to comment.