Skip to content

Commit 20d8df9

Browse files
author
Benjamin Calef
committed
allow to change php version statement after first provisioning
1 parent 5d01d8f commit 20d8df9

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

provision/010-system-packages.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ fi
4040
if $(dpkg --compare-versions "${PROJECT_VERSION}" "lt" "2.1"); then
4141
MAGENTO_PHP_VERSION="7.0";
4242
fi
43+
4344
# PHP packages
4445
apt-get update -y && apt-get install -y \
4546
php${MAGENTO_PHP_VERSION} php${MAGENTO_PHP_VERSION}-common php${MAGENTO_PHP_VERSION}-cli \
@@ -49,18 +50,17 @@ apt-get update -y && apt-get install -y \
4950
php${MAGENTO_PHP_VERSION}-mysql php${MAGENTO_PHP_VERSION}-sqlite3 libapache2-mod-php${MAGENTO_PHP_VERSION} \
5051
php${MAGENTO_PHP_VERSION}-memcache php${MAGENTO_PHP_VERSION}-redis php${MAGENTO_PHP_VERSION}-opcache \
5152
python ruby ruby-dev
52-
if [[ "${MAGENTO_PHP_VERSION}" == "7.1" ]]; then
53+
if [ "${MAGENTO_PHP_VERSION}" != "7.2" ]; then
5354
apt-get install -y php${MAGENTO_PHP_VERSION}-mcrypt
5455
fi
5556

56-
# Set php version
57-
PHP_VERSION="$(php --version | head -n 1 | cut -d " " -f 2 | cut -c 1,2,3)";
57+
# Set php version env
5858
if [[ -z $(grep "PHP_VERSION" "/etc/profile.d/env.sh") ]]; then
5959
cat <<EOF >> /etc/profile.d/env.sh
60-
export PHP_VERSION="${PHP_VERSION}"
60+
export PHP_VERSION="${MAGENTO_PHP_VERSION}"
6161
EOF
6262
else
63-
sed -i '/export PHP_VERSION*/c\'"export PHP_VERSION=$PHP_VERSION" /etc/profile.d/env.sh
63+
sed -i '/export PHP_VERSION*/c\'"export PHP_VERSION=${MAGENTO_PHP_VERSION}" /etc/profile.d/env.sh
6464
fi
6565
source /etc/profile.d/env.sh
6666

provision/020-system-services.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mysql -u root -ppassword -e "GRANT ALL PRIVILEGES ON * . * TO 'vagrant'@'localho
2121
mysql -u root -ppassword -e "GRANT ALL PRIVILEGES ON * . * TO 'vagrant'@'%';"
2222
mysql -u root -ppassword -e "FLUSH PRIVILEGES;"
2323

24+
2425
# -----------------------------------------------------------------------------------------------------
2526

2627

@@ -123,6 +124,7 @@ EOF
123124

124125
# -----------------------------------------------------------------------------------------------------
125126

127+
126128
# Apache php configuration
127129
sed -i 's/;opcache.enable=.*/opcache.enable=1/' /etc/php/"$PHP_VERSION"/apache2/php.ini
128130
sed -i 's/;opcache.enable_cli=.*/opcache.enable_cli=1/' /etc/php/"$PHP_VERSION"/apache2/php.ini
@@ -163,6 +165,7 @@ systemd-tmpfiles --create /etc/tmpfiles.d/php-cli-opcache.conf
163165

164166
# -----------------------------------------------------------------------------------------------------
165167

168+
166169
mkdir -p /var/www/html
167170
chown -R www-data:www-data /var/www/
168171

@@ -208,6 +211,7 @@ cat <<'EOF' > /etc/apache2/sites-available/001-ssl.conf
208211
</IfModule>
209212
EOF
210213

214+
# Enable modules
211215
a2dismod php7.0 php7.1 php7.2
212216
a2ensite 000-default
213217
a2ensite 001-ssl

provision/110-magento-app.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ "$PROJECT_SOURCE" == "composer" ]; then
3939
magento/module-downloadable-sample-data magento/module-msrp-sample-data \
4040
magento/module-configurable-sample-data magento/module-product-links-sample-data \
4141
magento/module-wishlist-sample-data magento/module-swatches-sample-data \
42-
magento/sample-data-media magento/module-offline-shipping-sample-data --no-update
42+
magento/sample-data-media magento/module-offline-shipping-sample-data
4343
fi
4444
else
4545
# Install from git

0 commit comments

Comments
 (0)