How to Upgrade to Magento 2.4.7 and 2.4.8

Upgrading Magento to versions 2.4.7 and 2.4.8 introduces several breaking changes that require attention during planning and execution. This guide covers the specific issues encountered during these upgrades and provides a structured approach to minimize downtime and risk.

What Changes in 2.4.7

Lowercase Elasticsearch Index Names

Starting with Magento 2.4.7-p7, Elasticsearch index names are enforced as lowercase. If your existing index prefix contains uppercase characters, reindexing after the upgrade will fail with:

Invalid Index Name Must Be Lowercase

Before upgrading, check your index prefix in Stores → Configuration → Catalog → Catalog Search → Elasticsearch Index Prefix. If it contains uppercase characters, change it to lowercase and reindex before starting the upgrade.

PHP 8.2 Support

Magento 2.4.7 adds PHP 8.2 support. If upgrading PHP alongside Magento, be aware that PHP 8.2 deprecates dynamic properties. Extensions that set undeclared class properties will generate deprecation warnings. While these are non-fatal in PHP 8.2, they become errors in PHP 8.4.

GraphQL Sorting Behavior

Magento uses MySQL for frontend catalog queries and Elasticsearch for GraphQL API queries. These engines handle sorting differently when multiple products have the same relevance score.

For example, a category listing sorted by position may show products in a different order via GraphQL compared to the Luma/Hyva frontend. This is expected behavior, not a bug. If consistent ordering is required across both channels, add an explicit secondary sort criteria (such as entity_id or creation date) to GraphQL queries.

What Changes in 2.4.8

Elasticsearch Removed

Magento 2.4.8 removes Elasticsearch support entirely. OpenSearch is the only supported catalog search engine. If your store still uses Elasticsearch, migrate to OpenSearch before upgrading.

See also: How to Configure Elasticsearch and OpenSearch in Magento 2

Laminas\Mime Dependency

Magento 2.4.8 updates several Laminas framework dependencies. Some third-party extensions may depend on older Laminas\Mime versions, causing Composer conflicts during the upgrade.

If you encounter Laminas\Mime dependency errors:

  1. Check which package requires the conflicting version: composer why laminas/laminas-mime
  2. Contact the extension vendor for an updated version compatible with 2.4.8
  3. As a temporary workaround, add the extension to the replace section or use composer require with the --with-all-dependencies flag

Writable /var Directory

Adobe's documentation for 2.4.8 explicitly requires the /var directory to be writable by the web server. While this has always been a best practice, some hardened hosting configurations restrict write access to /var subdirectories selectively. Ensure full write access to the entire /var directory tree before upgrading.

Pre-Upgrade Checklist

Before starting the upgrade:

  1. Check PHP compatibility: Verify your PHP version is supported by the target Magento version
  2. Review extension compatibility: Check with each extension vendor whether their extension supports the target version
  3. Back up the database: mysqldump -u [user] -p [database] > backup_pre_upgrade.sql
  4. Back up the codebase: Create a full backup or ensure your deployment can be rolled back via Git
  5. Review the Adobe release notes: Check for additional breaking changes specific to your configuration
  6. Test in staging: Never upgrade production first
  7. Check Elasticsearch/OpenSearch version: Ensure your search engine version is compatible with the target Magento version

Upgrade Steps

1. Enable Maintenance Mode

php bin/magento maintenance:enable

2. Update Composer Dependencies

# For Community Edition
composer require magento/product-community-edition=2.4.8 --no-update
composer update --with-dependencies

If Composer shows dependency conflicts, resolve them before proceeding. Common resolutions:

  • Update conflicting extensions to compatible versions
  • Remove extensions that do not support the target version
  • Use --with-all-dependencies to allow Composer to resolve transitive dependencies

3. Run Deployment Commands

php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

4. Verify the Upgrade

# Check version
php bin/magento --version

# Check for setup upgrade issues
php bin/magento setup:db:status

# Reindex
php bin/magento indexer:reindex

5. Disable Maintenance Mode

php bin/magento maintenance:disable

Post-Upgrade Verification

After the upgrade, test these areas:

  • Storefront: Browse categories, search for products, add items to cart
  • Checkout: Complete a test order with each enabled payment method
  • Admin panel: Verify admin login, product editing, and order management
  • Cron jobs: Check that cron is running and the cron_schedule table shows new entries
  • Search: Verify search results and layered navigation filters display correctly
  • Extensions: Test each third-party extension's functionality

Rollback Strategy

If the upgrade fails or introduces critical issues:

  1. Restore the database from the pre-upgrade backup
  2. Restore the codebase from Git or file backup
  3. Run deployment commands on the restored codebase
  4. Disable maintenance mode

Having a tested rollback procedure is essential before any major version upgrade.

Loading...