Magento 2 – tips, tricks and notes

Apache and PHP settings which need changing for this to work.

Server Config

  • PHP will need the intl extension – php-intl.
  • PHP will need the dom extension – php-dom package.


  • max_execution_time: 30 seconds isn’t log enough in the admin interface which doesn’t have caching
  • max_input_time: this will mostly catch you out for image uploads
  • max_input_vars: Adding configurable products with many options will fail at the default of 1000 as magento doesn’t serialise large data sets
  • memory_limit: Again the admin interface will need more
  • post_max_size: Either scale down images first, or increase this to allow large uploads. Try to make memory_limit more than the post_max_size as while image uploads do not go directly into RAM, the image processing will generally need as much space as the uncompressed image you’ve just uploaded.
  • upload_max_filesize: aim for 50% bigger than the photos you will be uploading.

Other issues

  • Adding configurable products with images often fails –
    magento 2 processes images seperately for each virtual product it seems, so often fails to save a configurable product with many options and images.

Remember to restart the apache2 server after changing these settings. If you’re using php_fpm then you’ll need to restart that too.

Magento 2 Performance issues, relating to MySQL

Search caching for search terms with multiple layers of layered navigation and active search engines is a problem. Mitigations for this excessive database load:

Queries look like:
INSERT INTO `search_tmp_#RANDOMNUMBER#` SELECT `main_select` …

  1. Use Robots.txt to reduce crawling of the layered navigation - either block it entirely or block crawling multiple queries in one get request
  2. turn off filterable in layered navigation for attributes where this is not necessary to avoid too many combinations
  3. Speed up MySQL - 
    2. Speed up MySQL by adding caching in RAM to cover more of the database
    3. Add indexing on critical tables in the query – catalog_product_index_eav

Magento message translation

  • Please re-run Magento compile command
  • cd $magento_root && /$PHP_PATH/php bin/magento setup:di:compile