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 7c4fd53 commit 4c27cc5
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

- PHP 7.1 support
- PHP 7.1 and PHP 7.2 support
- Support for new location of `generated` directory in Magento 2.2.0
- Basic data generation can be turned off. Added configurable product and customer address generation

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ See [draft](https://github.com/paliarush/magento2-vagrant-for-developers/issues/
### Switch between PHP versions
Switch between PHP versions using "php_version: <version>" option in [config.yaml](etc/config.yaml.dist). Supported versions are 5.6, 7.0 and 7.1.
Switch between PHP versions using "php_version: <version>" option in [config.yaml](etc/config.yaml.dist). Supported versions are 5.6, 7.0, 7.1 and 7.2.
PHP version will be applied after "vagrant reload".
### Activating Varnish
Expand Down
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.0"
composer_prefer_source: 0
# [To apply changes: m-reinstall OR m-varnish enable/disable]
Expand Down
6 changes: 3 additions & 3 deletions scripts/provision/configure_environment_recurring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ fi

status "Setting up PHP"

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)
a2dismod php5.6 2> >(logError) > >(log) && a2dismod php7.0 2> >(logError) > >(log) && a2dismod php7.1 2> >(logError) > >(log) && a2dismod php7.2 2> >(logError) > >(log)
a2enmod "php${php_version}" 2> >(logError) > >(log)
sed -i "s|xdebug.remote_connect_back=1|xdebug.remote_host=192.168.10.1|g" "/etc/php/${php_version}/cli/conf.d/20-xdebug.ini"
else
Expand Down
51 changes: 48 additions & 3 deletions scripts/provision/upgrade_environment_recurring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ function install_php71 () {
# Install XDebug
apt-get install -y php7.1-dev
cd /usr/lib
rm -rf xdebug
rm -rf xdebug71
git clone git://github.com/xdebug/xdebug.git
cd xdebug
cd xdebug71
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
echo 'zend_extension=/usr/lib/xdebug71/modules/xdebug.so
xdebug.max_nesting_level=200
xdebug.remote_enable=1
xdebug.remote_host=192.168.10.1
Expand All @@ -120,10 +120,55 @@ function install_php71 () {
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 xdebug72
git clone git://github.com/xdebug/xdebug.git
cd xdebug72
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/xdebug72/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
}


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

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

# TODO: Fix for a bug, should be removed in 3.0
sed -i "/zend_extension=.*so/d" /etc/php/7.0/cli/conf.d/20-xdebug.ini
echo "zend_extension=xdebug.so" >> /etc/php/7.0/cli/conf.d/20-xdebug.ini

status "Fixing potential issue with MySQL being down after VM power off"
service mysql restart 2> >(logError) > >(log)

Expand Down

0 comments on commit 4c27cc5

Please sign in to comment.