Magento System Requirements: PHP and Memory Requirements
Magento is a resource-intensive platform that requires specific server configuration. In this guide, we describe the system requirements for an optimally running Magento webshop. It is crucial to ensure that your hosting environment meets these requirements to maximize the performance of your webshop and guarantee a smooth user experience.
Magento 2.4.x System Requirements
PHP Version and Extensions
Required PHP version:
- Magento 2.4.6+: PHP 8.1 or 8.2
- Magento 2.4.4-2.4.5: PHP 8.1
- Magento 2.4.3: PHP 7.4 or 8.0
It is important to always use the most recent version of PHP that is compatible with your Magento version. This not only ensures better performance but also improved security and new functionalities.
Required PHP extensions:
- bcmath
- ctype
- curl
- dom
- fileinfo
- gd (with FreeType)
- hash
- iconv
- intl
- json
- libxml
- mbstring
- openssl
- pcre
- pdo_mysql
- simplexml
- soap
- sockets
- sodium
- spl
- tokenizer
- xmlwriter
- xsl
- zip
- zlib
These extensions are essential for the operation of Magento. Ensure they are enabled in your PHP configuration. This can often be done via your hosting provider's control panel.
Database Requirements
Supported databases:
- MySQL 8.0 (recommended)
- MariaDB 10.4 or higher
- Percona 8.0
Database configuration:
- InnoDB storage engine
- utf8mb4 character set
- utf8mb4_unicode_ci collation
Using the correct database configuration is crucial for the performance of your Magento webshop. The InnoDB engine, for example, offers better performance and support for transactions, which is essential for an e-commerce platform.
Memory Requirements
| Environment | Minimum | Recommended |
|---|---|---|
| Development | 2GB RAM | 4GB RAM |
| Production (small) | 4GB RAM | 8GB RAM |
| Production (large) | 8GB RAM | 16GB+ RAM |
PHP memory_limit:
- Minimum: 756M
- Recommended: 2G or higher
- For large import/export: 4G
A good memory configuration is crucial for the performance of Magento. If you notice that your webshop is slow or frequently crashes, increasing the memory may be a solution.
Web Server
Supported web servers:
- Apache 2.4 with mod_rewrite
- Nginx 1.x (recommended for performance)
- LiteSpeed (excellent performance)
Apache configuration:
<Directory /var/www/html/magento>
AllowOverride All
Require all granted
</Directory>
The choice of web server can have a significant impact on the performance of your Magento webshop. Nginx is often preferred due to its efficiency and speed, especially under high traffic volumes.
Disk Space
Minimum space:
- Magento installation: 2GB
- Media/uploads: depending on products
- Database: depending on catalog size
- Logs and cache: 1-5GB
Recommended total: At least 10GB available
Optimizing PHP Configuration
Recommended php.ini settings
memory_limit = 2G
max_execution_time = 18000
max_input_time = 600
max_input_vars = 10000
post_max_size = 64M
upload_max_filesize = 64M
realpath_cache_size = 10M
realpath_cache_ttl = 7200
opcache.enable = 1
opcache.memory_consumption = 512
opcache.max_accelerated_files = 60000
opcache.validate_timestamps = 0
Changing PHP Settings in DirectAdmin
- Log in to DirectAdmin
- Go to Advanced Features → Select PHP Version
- Click Switch to PHP Options
- Adjust the values, such as
memory_limit,max_execution_timeandmax_input_vars - Click Save
Can't set a value high enough? Contact our support team.
OPcache Configuration
OPcache is essential for Magento performance:
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=60000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=0
opcache.save_comments=1
MySQL/MariaDB Configuration
Recommended my.cnf settings
[mysqld]
innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
max_connections = 500
tmp_table_size = 256M
max_heap_table_size = 256M
Composer
Magento uses Composer to manage packages and extensions. Composer is available via SSH. Check the version with:
composer --version
Magento 2.4.x works with Composer 2. Read more in Using Composer via SSH.
Elasticsearch/OpenSearch
Starting from Magento 2.4, a search engine is mandatory:
- OpenSearch 2.x or Elasticsearch 8.x, depending on your Magento version (current 2.4.x releases no longer support Elasticsearch 7)
- Minimum 512MB heap size
- Recommended 2GB heap for larger catalogs
Elasticsearch significantly improves the search functionality of your webshop. It allows you to quickly and efficiently search through large amounts of product data, which is crucial for a good user experience.
Redis (optional but recommended)
Redis significantly improves performance:
- Session storage: Faster sessions than file-based
- Cache backend: Faster cache than file-based
- Full Page Cache: Better FPC performance
Using Redis can significantly improve your webshop's loading times, especially during high visitor volumes. This is particularly important during peak periods, such as holidays or special promotions.
Checking if Your Hosting Meets Requirements
Via DirectAdmin
- Go to PHP Version or PHP Settings
- Check the PHP version and settings
- View available extensions
Via phpinfo()
- Create a file
info.phpwith content:<?php phpinfo(); ?> - Open the file in your browser
- Check all settings
- Delete the file after checking (security risk)
Via Composer and bin/magento
The Readiness Check and the web setup wizard no longer exist since Magento 2.4. Checks now happen during installation via SSH:
composer create-projectreports an outdated PHP version or missing PHP extensionsbin/magento setup:installtests the database connection and the connection to the search engine
Performance Tips
- Use the latest PHP version supported by your Magento version
- Use LiteSpeed Cache: see Configure Magento with LiteSpeed Cache
- Limit extensions to what you really need
- Consider a CDN for images and static files
When to Upgrade?
Consider a more powerful hosting package if:
- You regularly receive timeout errors
- The admin responds slowly
- Import/export fails due to memory limits
- Your catalog grows above 10,000 products
Hosting Package Advice
Choose the right package for your Magento shop:
Starter Shop (up to 500 products)
- Minimum 4GB RAM
- 10GB disk space
- Shared hosting may suffice
Growing Shop (500-5000 products)
- 8GB RAM recommended
- SSD storage
- VPS or dedicated server
Enterprise (5000+ products)
- 16GB+ RAM
- Dedicated server
- CDN for media
Need Help?
We are here for you! Are you facing any issues or have questions? Our support team is happy to assist you personally. Send us a message via the ticket system - we usually respond within a few hours and are happy to help.
Looking for web hosting? See what we offer.
0 of 0 found this helpful