Skip to content

Commit

Permalink
Added PHP 7.2 support for Magento 2.3 #169
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Paliarush committed Apr 4, 2018
1 parent ffd8967 commit a117baf
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 74 deletions.
2 changes: 1 addition & 1 deletion etc/config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ guest:
forwarded_ssh_port: 3000

environment:
# [To apply changes: vagrant reload] Valid versions: 5.6, 7.0, 7.1
# [To apply changes: vagrant reload] Valid versions: 5.6, 7.0, 7.1, 7.2
php_version: "7.1"
composer_prefer_source: 0
# [To apply changes: m-reinstall OR m-varnish enable/disable]
Expand Down
45 changes: 2 additions & 43 deletions scripts/provision/configure_environment_recurring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,6 @@ function process_php_config () {
done
}

function install_php71 () {
status "Installing PHP 7.1"

apt-get update

# Setup PHP
apt-get install -y language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update

# Install PHP 7.1
apt-get install -y php7.1 php7.1-mcrypt php7.1-curl php7.1-cli php7.1-mysql php7.1-gd php7.1-intl php7.1-xsl php7.1-bcmath php7.1-mbstring php7.1-soap php7.1-zip libapache2-mod-php7.1

# Install XDebug
apt-get install -y php7.1-dev
cd /usr/lib
rm -rf xdebug
git clone git://github.com/xdebug/xdebug.git
cd xdebug
phpize
./configure --enable-xdebug
make
make install
## Configure XDebug to allow remote connections from the host
mkdir -p /etc/php/7.1/cli/conf.d
touch /etc/php/7.1/cli/conf.d/20-xdebug.ini
echo 'zend_extension=/usr/lib/xdebug/modules/xdebug.so
xdebug.max_nesting_level=200
xdebug.remote_enable=1
xdebug.remote_host=192.168.10.1
xdebug.idekey=phpstorm' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini
echo "date.timezone = America/Chicago" >> /etc/php/7.1/cli/php.ini
rm -rf /etc/php/7.1/apache2
ln -s /etc/php/7.1/cli /etc/php/7.1/apache2
}

function isServiceAvailable() {
all_services="$(service --status-all 2> >(log))"
if [[ ${all_services} =~ ${1} ]]; then
Expand Down Expand Up @@ -116,14 +80,9 @@ fi

status "Setting up PHP"

if [[ ! -d "/etc/php/7.1" ]]; then
install_php71
fi

php_ini_paths=( /etc/php/5.6/cli/php.ini /etc/php/7.0/cli/php.ini /etc/php/7.1/cli/php.ini )
php_ini_paths=( /etc/php/5.6/cli/php.ini /etc/php/7.0/cli/php.ini /etc/php/7.1/cli/php.ini /etc/php/7.2/cli/php.ini )
process_php_config ${php_ini_paths}

if [[ ${php_version} == "5.6" ]] || [[ ${php_version} == "7.0" ]] || [[ ${php_version} == "7.1" ]]; then
if [[ ${php_version} == "5.6" ]] || [[ ${php_version} == "7.0" ]] || [[ ${php_version} == "7.1" ]] || [[ ${php_version} == "7.2" ]]; then
status "Configuring PHP ${php_version}"
update-alternatives --set php "/usr/bin/php${php_version}"
a2dismod php5.6 2> >(logError) > >(log) && a2dismod php7.0 2> >(logError) > >(log) && a2dismod php7.1 2> >(logError) > >(log)
Expand Down
108 changes: 78 additions & 30 deletions scripts/provision/upgrade_environment_recurring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,78 @@ function isServiceAvailable() {
fi
}

function install_php71 () {
status "Installing PHP 7.1"

apt-get update

# Setup PHP
apt-get install -y language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update

# Install PHP 7.1
apt-get install -y php7.1 php7.1-mcrypt php7.1-curl php7.1-cli php7.1-mysql php7.1-gd php7.1-intl php7.1-xsl php7.1-bcmath php7.1-mbstring php7.1-soap php7.1-zip libapache2-mod-php7.1

# Install XDebug
apt-get install -y php7.1-dev
cd /usr/lib
rm -rf xdebug
git clone git://github.com/xdebug/xdebug.git
cd xdebug
phpize
./configure --enable-xdebug
make
make install
## Configure XDebug to allow remote connections from the host
mkdir -p /etc/php/7.1/cli/conf.d
touch /etc/php/7.1/cli/conf.d/20-xdebug.ini
echo 'zend_extension=/usr/lib/xdebug/modules/xdebug.so
xdebug.max_nesting_level=200
xdebug.remote_enable=1
xdebug.remote_host=192.168.10.1
xdebug.idekey=phpstorm' >> /etc/php/7.1/cli/conf.d/20-xdebug.ini
echo "date.timezone = America/Chicago" >> /etc/php/7.1/cli/php.ini
rm -rf /etc/php/7.1/apache2
ln -s /etc/php/7.1/cli /etc/php/7.1/apache2
}

function install_php72 () {
status "Installing PHP 7.2"

apt-get update

# Setup PHP
apt-get install -y language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update

# Install PHP 7.2
apt-get install -y php7.2 php7.2-curl php7.2-cli php7.2-mysql php7.2-gd php7.2-intl php7.2-xsl php7.2-bcmath php7.2-mbstring php7.2-soap php7.2-zip libapache2-mod-php7.2

# Install XDebug
apt-get install -y php7.2-dev
cd /usr/lib
rm -rf xdebug
git clone git://github.com/xdebug/xdebug.git
cd xdebug
phpize
./configure --enable-xdebug
make
make install
## Configure XDebug to allow remote connections from the host
mkdir -p /etc/php/7.2/cli/conf.d
touch /etc/php/7.2/cli/conf.d/20-xdebug.ini
echo 'zend_extension=/usr/lib/xdebug/modules/xdebug.so
xdebug.max_nesting_level=200
xdebug.remote_enable=1
xdebug.remote_host=192.168.10.1
xdebug.idekey=phpstorm' >> /etc/php/7.2/cli/conf.d/20-xdebug.ini
echo "date.timezone = America/Chicago" >> /etc/php/7.2/cli/php.ini
rm -rf /etc/php/7.2/apache2
ln -s /etc/php/7.2/cli /etc/php/7.2/apache2
}

use_php7=$4
vagrant_dir="/vagrant"

Expand All @@ -17,36 +89,12 @@ source "${vagrant_dir}/scripts/output_functions.sh"
status "Upgrading environment (recurring)"
incrementNestingLevel

status "Deleting obsolete repository"
sudo rm -f /etc/apt/sources.list.d/ondrej-php-7_0-trusty.list

status "Upgrading vagrant box paliarush/magento2.ubuntu v1.1.0"
if [[ ${use_php7} -eq 1 ]]; then
if /usr/bin/php7.0 -v | grep -q '7.0.5' ; then
status "Upgrading PHP 7.0.5"
apt-get update 2> >(logError) > >(log)
a2dismod php7.0 2> >(logError) > >(log)
rm -rf /etc/php/7.0/apache2
export DEBIAN_FRONTEND=noninteractive
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install php7.0 php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql php7.0-gd php7.0-intl php7.0-xsl php7.0-bcmath php7.0-mbstring php7.0-soap php7.0-zip libapache2-mod-php7.0 2> >(logError) > >(log)
a2enmod php7.0 2> >(logError) > >(log)

status "Installing XDebug"
cd /usr/lib
rm -rf xdebug
git clone git://github.com/xdebug/xdebug.git 2> >(logError) > >(log)
cd xdebug
phpize 2> >(logError) > >(log)
./configure --enable-xdebug 2> >(logError) > >(log)
make 2> >(logError) > >(log)
make install 2> >(logError) > >(log)

rm -rf /etc/php/7.0/apache2
ln -s /etc/php/7.0/cli /etc/php/7.0/apache2

status "Restarting Apache"
service apache2 restart 2> >(logError) > >(log)
fi
if [[ ! -d "/etc/php/7.1" ]]; then
install_php71
fi

if [[ ! -d "/etc/php/7.2" ]]; then
install_php72
fi

is_varnish_installed="$(isServiceAvailable varnish)"
Expand Down

0 comments on commit a117baf

Please sign in to comment.