Skip to content

Commit a16fe71

Browse files
author
Benjamin Calef
authored
Merge pull request #12 from zepgram/fix/php-version
Fix/php version
2 parents 35d6bcb + 20d8df9 commit a16fe71

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

provision/010-system-packages.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sourc
3535
# Set required php version
3636
MAGENTO_PHP_VERSION="7.2";
3737
if $(dpkg --compare-versions "${PROJECT_VERSION}" "lt" "2.3"); then
38+
MAGENTO_PHP_VERSION="7.1";
39+
fi
40+
if $(dpkg --compare-versions "${PROJECT_VERSION}" "lt" "2.1"); then
3841
MAGENTO_PHP_VERSION="7.0";
3942
fi
4043

@@ -47,18 +50,17 @@ apt-get update -y && apt-get install -y \
4750
php${MAGENTO_PHP_VERSION}-mysql php${MAGENTO_PHP_VERSION}-sqlite3 libapache2-mod-php${MAGENTO_PHP_VERSION} \
4851
php${MAGENTO_PHP_VERSION}-memcache php${MAGENTO_PHP_VERSION}-redis php${MAGENTO_PHP_VERSION}-opcache \
4952
python ruby ruby-dev
50-
if [[ "${MAGENTO_PHP_VERSION}" == "7.0" ]]; then
53+
if [ "${MAGENTO_PHP_VERSION}" != "7.2" ]; then
5154
apt-get install -y php${MAGENTO_PHP_VERSION}-mcrypt
5255
fi
5356

54-
# Set php version
55-
PHP_VERSION="$(php --version | head -n 1 | cut -d " " -f 2 | cut -c 1,2,3)";
57+
# Set php version env
5658
if [[ -z $(grep "PHP_VERSION" "/etc/profile.d/env.sh") ]]; then
5759
cat <<EOF >> /etc/profile.d/env.sh
58-
export PHP_VERSION="${PHP_VERSION}"
60+
export PHP_VERSION="${MAGENTO_PHP_VERSION}"
5961
EOF
6062
else
61-
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
6264
fi
6365
source /etc/profile.d/env.sh
6466

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/100-magento-pre.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ EOF
7070

7171
# Copy credentials to project user
7272
chown -R vagrant:vagrant /home/vagrant
73+
mkdir -p /home/"$PROJECT_USER"/.composer /home/"$PROJECT_USER"/.ssh
7374
cp -r /home/vagrant/.composer/* /home/"$PROJECT_USER"/.composer/
7475
cp -r /home/vagrant/.ssh/* /home/"$PROJECT_USER"/.ssh/
7576
chown -R "$PROJECT_USER":"$PROJECT_USER" /home/"$PROJECT_USER"

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)