Skip to content

Commit

Permalink
Added PHP 7.1 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 c9f955e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 45 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Config option 'php_version' should now be used for PHP version selection instead of 'use_php7'
- Upgraded Varnish to v4.1
- Improved Magento re-installation speed by avoiding unnecessary cache cleaning
- Custom code sniffer rules replaced with PSR2

### Added

- PHP 7.1 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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* [Update Composer dependencies](#update-composer-dependencies)
* [Running Magento tests](#running-magento-tests)
* [Environment configuration](#environment-configuration)
* [Switch between PHP 5.6 and 7.0](#switch-between-php-56-and-70)
* [Switch between PHP versions](#switch-between-php-56-and-70)
* [Activating Varnish](#activating-varnish)
* [Activating ElasticSearch](#activating-elasticsearch)
* [Redis for caching](#redis-for-caching)
Expand Down Expand Up @@ -291,9 +291,9 @@ See [draft](https://github.com/paliarush/magento2-vagrant-for-developers/issues/
## Environment configuration
### Switch between PHP 5.6 and 7.0
### Switch between PHP versions
Set "use_php7: 1" for PHP7 and "use_php7: 0" for PHP5.6 in [config.yaml](etc/config.yaml.dist).
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.
PHP version will be applied after "vagrant reload".
### Activating Varnish
Expand Down Expand Up @@ -358,7 +358,6 @@ Note: See [Working with npm](https://www.npmjs.com/package/n#working-with-npm) i

### FAQ

1. Upgrade to PHP 7.1 can be done as described [here](https://gist.github.com/paliarush/6d88f3267de3bac636956f4be6bb3cd8#file-steps-to-upgrade-environment-to-php-7-1-md). Keep in mind that this is a temporary hack until proper support is implemented in the box
1. To debug any CLI script in current Vagrant project, set `debug:vagrant_project` option in [config.yaml](etc/config.yaml.dist) to `1`
1. Is Windows 10 supported? Yes, but you may face the same issue as described [here](https://github.com/paliarush/magento2-vagrant-for-developers/issues/36). Also Virtual box may not work on Windows 10 in headless mode, see how to [enable GUI mode](https://www.vagrantup.com/docs/virtualbox/configuration.html)
1. ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) On OSX and \*nix hosts NFS will be used by default to sync your project files with guest. On some hosts Vagrant cannot configure NFS properly, in this case it is possible to deploy project without NFS by setting `use_nfs` option in [config.yaml](etc/config.yaml.dist) to `0` <br />
Expand Down
2 changes: 1 addition & 1 deletion etc/config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ guest:

environment:
# [To apply changes: vagrant reload] Valid versions: 5.6, 7.0, 7.1
php_version: "7.1"
php_version: "7.0"
composer_prefer_source: 0
# [To apply changes: m-reinstall OR m-varnish enable/disable]
use_varnish: 0
Expand Down
40 changes: 0 additions & 40 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,10 +80,6 @@ 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 )
process_php_config ${php_ini_paths}

Expand Down
40 changes: 40 additions & 0 deletions scripts/provision/upgrade_environment_recurring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,46 @@ if [[ ${is_redis_installed} -eq 0 ]]; then
echo -n | sudo utils/install_server.sh 2> >(logError) > >(log)
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
}

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

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

Expand Down

0 comments on commit c9f955e

Please sign in to comment.