[Upgrade to Magento 2.3.x was originally written for 2.3.0; however, we have upgraded several customers to 2.3.1 and 2.3.2 with this process.]
With Magento’s new big release of 2.3.x that is loaded with features, improvements, and security updates, how can one not feel the temptation not to attempt an upgrade? Even out of necessity, because PHP 7.1 is officially no longer supported by PHP, then we only feel obligated to upgrade to 2.3.x, because it now supports a welcomed PHP 7.2.
For aMiSTACX G3/G4 customers this upgrade process does NOT need to be a painful experience as PHP 7.2 should already be pre-installed. In fact, we have already performed several upgrades for our customers, and on our base stacks, and we feel the process we have documented should work 99% of the time.
That said, you have to conduct your own due-diligence as your themes or modules may not be compatible with Magento 2.3.x and/or PHP 7.2.
Pre-Upgrade
- Make a clone of your AWS EC2 server and label it Development in the AWS console or A51.
- Make use of a hosts file for testing
- Make sure composer is installed and up to date.
- Add this this line to the /var/www/magento/composer.json file:
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
Your section block should look something like this: - Tip: Don’t forget the ” , “ at the end of the line above the new line.
sudo composer dumpautoload
Upgrade Procedures
cd /var/www/magento
sudo php bin/magento deploy:mode:set developer
sudo php bin/magento maintenance:enable
sudo php bin/magento cache:clean
sudo composer require <product> <version> –no-update
e.g sudo composer require magento/product-community-edition 2.3.0 --no-update
sudo composer config --global discard-changes true
sudo composer config preferred-install dist
sudo composer config sort-packages true
sudo composer config prefer-stable true
sudo composer require --dev friendsofphp/php-cs-fixer:~2.10.0 --no-update
sudo composer require --dev sebastian/phpcpd:~3.0.0 --no-update
sudo composer update
sudo redis-cli flushall
sudo php bin/magento cache:clean
sudo php bin/magento cache:disable
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:upgrade
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:di:compile
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:static-content:deploy -f
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento cache:enable
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento maintenance:disable
Switch to PHP 7.2 from 7.1 for Apache! [NGINX customers consult the AMIS stack guide.]
sudo service php7.1-fpm stop
sudo systemctl disable php7.1-fpm
# Double-Check, but these should already be disabled
sudo a2dismod php7.0
sudo a2dismod php7.1
sudo a2dismod php7.2
sudo a2disconf php7.1-fpm.conf
sudo a2enconf php7.2-fpm.conf
sudo service apache2 restart
sudo systemctl enable php7.2-fpm
sudo service php7.2-fpm restart
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.2
sudo a2enmod proxy_fcgi setenvif
# Verify PHP 7.2 with Opcache
php -version
# Double-Checking Services Running
systemctl status php7.2-fpm
systemctl status apache2
Welcome to Magento 2.3.x
You should now be upgraded to 2.3.x w/ PHP 7.2. You’ll want to check the web server logs, and Magento logs to make sure you have no errors.
That’s it! Good Luck 😉