PHP / Magento Dev Blog

  • Publikacje
  • O autorze
  • Kontakt

Magento 2.4.8 – PHP 8.4 support, Elasticsearch to OpenSearch migration, upgrade checklist

by Henryk Tews / Tuesday, 31 December 2024 / Published in Magento 2

Magento 2.4.8 was released in April 2025 and is the most significant update in the 2.4.x line. PHP 8.4 support, dropping official Elasticsearch support in favour of OpenSearch, and a long list of dependency updates make this a mandatory upgrade for projects that want to stay on supported software. I show what actually changes and provide a practical upgrade checklist.

Key changes in Magento 2.4.8

Area Change Impact
PHP support PHP 8.4 fully supported, PHP 8.1 dropped High – upgrade required for security
Search OpenSearch 2.x is the required engine, Elasticsearch deprecated High for ES users
MariaDB 10.6+ required, 10.4 dropped Medium
Composer Composer 2.7+ required Low
Adobe Commerce B2B modules updated, new GraphQL features Medium for B2B
Security CSP improvements, admin 2FA enforcement Medium

Elasticsearch to OpenSearch migration

# Check current search engine configuration
bin/magento config:show catalog/search/engine
# Should be: opensearch (if already migrated) or elasticsearch7 (needs migration)

# Step 1: Install OpenSearch 2.x (replace Elasticsearch in docker-compose)
# OpenSearch is a fork of Elasticsearch 7.10 - indices are compatible

# Step 2: Point Magento to OpenSearch
bin/magento config:set catalog/search/engine opensearch
bin/magento config:set catalog/search/opensearch_server_hostname opensearch
bin/magento config:set catalog/search/opensearch_server_port 9200
bin/magento config:set catalog/search/opensearch_index_prefix magento2

# Step 3: Rebuild search indices
bin/magento indexer:reindex catalogsearch_fulltext

# Step 4: Verify
bin/magento indexer:status
curl http://opensearch:9200/_cat/indices?v
# docker-compose update: replace elasticsearch with opensearch
# OLD:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

# NEW:
  opensearch:
    image: opensearchproject/opensearch:2.13.0
    environment:
      - discovery.type=single-node
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
      - DISABLE_SECURITY_PLUGIN=true  # development only
    ports:
      - "9200:9200"

PHP 8.4 upgrade checklist for Magento modules

# 1. Run PHP compatibility checker
composer require --dev phpcompatibility/phpcompatibility-wp
vendor/bin/phpcs -p app/code/ --standard=PHPCompatibility --runtime-set testVersion 8.4

# 2. PHPStan with PHP 8.4 baseline
vendor/bin/phpstan analyse app/code/ --php-version=8.4 --level=5

# 3. Rector dry-run for PHP 8.4 migration
vendor/bin/rector process app/code/ --php-version=8.4 --dry-run

# 4. Check deprecated functions
php -l app/code/Vendor/Module/Model/*.php

# 5. Run tests
vendor/bin/phpunit --coverage-clover coverage.xml

Full upgrade process

# Prepare on staging environment first

# 1. Backup
mysqldump -u magento -p magento > backup_before_248.sql
rsync -av pub/media/ backup_media/

# 2. Enable maintenance
bin/magento maintenance:enable

# 3. Update Magento core
composer require magento/product-community-edition=2.4.8 \
    --no-update --no-interaction
composer update --no-interaction

# 4. Run setup
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy pl_PL en_US -f

# 5. Flush everything
bin/magento cache:clean
bin/magento cache:flush

# 6. Rebuild indices
bin/magento indexer:reindex

# 7. Disable maintenance
bin/magento maintenance:disable

# 8. Smoke test
curl -I https://shop.example.com/
curl -I https://shop.example.com/admin/

Common issues after upgrade

# Issue 1: Third-party module not compatible with 2.4.8
# Check: composer why-not magento/product-community-edition:2.4.8
# Fix: contact vendor or fork and patch the module

# Issue 2: Dynamic properties in custom modules (PHP 8.2+ deprecation, 8.4 might warn)
vendor/bin/rector process app/code/ \
    --only=\Rector\Php82\Rector\Class_\AllowDynamicPropertiesAttributeRector

# Issue 3: OpenSearch index not rebuilt
bin/magento indexer:reset catalogsearch_fulltext
bin/magento indexer:reindex catalogsearch_fulltext

# Issue 4: Admin 2FA now enforced (was optional before)
# If you don't want 2FA on staging:
bin/magento config:set twofactorauth/general/force_providers 0
bin/magento module:disable Magento_TwoFactorAuth

# Issue 5: CSP violations in browser console
# Check: browser devtools -> Console -> CSP errors
# Fix: add hashes or nonces via etc/csp_whitelist.xml in your module

Summary

Magento 2.4.8 is a significant release that aligns the platform with current infrastructure standards. The PHP 8.4 support brings all the performance and language improvements covered in recent posts. The OpenSearch migration is the most disruptive change for existing installations but is straightforward in practice – OpenSearch is API-compatible with Elasticsearch 7.x so indices transfer cleanly. Plan 2-4 hours for a typical upgrade on a well-maintained installation.

About Henryk Tews

What you can read next

Xdebug – configuration, PHPStorm, debugging Magento plugins
Strategy pattern in PHP – and how Magento 2 uses it in pricing

© 2026 Created by

TOP
Zarządzaj zgodą
Aby zapewnić jak najlepsze wrażenia, korzystamy z technologii, takich jak pliki cookie, do przechowywania i/lub uzyskiwania dostępu do informacji o urządzeniu. Zgoda na te technologie pozwoli nam przetwarzać dane, takie jak zachowanie podczas przeglądania lub unikalne identyfikatory na tej stronie. Brak wyrażenia zgody lub wycofanie zgody może niekorzystnie wpłynąć na niektóre cechy i funkcje.
Funkcjonalne Always active
Przechowywanie lub dostęp do danych technicznych jest ściśle konieczny do uzasadnionego celu umożliwienia korzystania z konkretnej usługi wyraźnie żądanej przez subskrybenta lub użytkownika, lub wyłącznie w celu przeprowadzenia transmisji komunikatu przez sieć łączności elektronicznej.
Preferencje
Przechowywanie lub dostęp techniczny jest niezbędny do uzasadnionego celu przechowywania preferencji, o które nie prosi subskrybent lub użytkownik.
Statystyka
Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do celów statystycznych. Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do anonimowych celów statystycznych. Bez wezwania do sądu, dobrowolnego podporządkowania się dostawcy usług internetowych lub dodatkowych zapisów od strony trzeciej, informacje przechowywane lub pobierane wyłącznie w tym celu zwykle nie mogą być wykorzystywane do identyfikacji użytkownika.
Marketing
Przechowywanie lub dostęp techniczny jest wymagany do tworzenia profili użytkowników w celu wysyłania reklam lub śledzenia użytkownika na stronie internetowej lub na kilku stronach internetowych w podobnych celach marketingowych.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Zobacz preferencje
  • {title}
  • {title}
  • {title}