lechowski / 13.11.2021

Best PHP configuration for PrestaShop

The settings below are tested in production for 500 to 20.000 products and 3 mio attributes. To have a flexible and better server features management and also the best speed for to work with Prestasho,p take a dedicated or a VPS root server. Managed servers in most of the cases don't have the possibility to make own changes needed on the server configuration.

You need at least php 5.6.30. Better performance you will get with php 7 and mySQL 5.7 or mariaDB 10. There is no need for accelerators, in contrary, best is the use of php-fpm + opcache + ngnix proxied.

  • magic_quotes_gpc = off
  • memory_limit = 512M
  • max_execution_time = 300
  • max_input_time = 300
  • upload_max_filesize = 20M
  • post_max_size = 20M
  • max_input_vars = 10000
  • allow_url_fopen = on 
  • safe_mode = off
  • cURL - installed
  • mod_rewrite = installed
  • mod_security = off

At least php 5.6.x + php-fpm + opcache with its own values (see below), better perfromance with php 7.

  • mySQL 5.6 or higher (better perfromance with mySQL 5.7 or mariaDB)
  • JSON = ON
  • ctype = ON
  • mySQL = INNODB (myIsam does not work correctly)
  • php.ini from the server must include the date.timezone
  • Open SSL 1.2 or higher
  • (Prestashop is not recommended on Windows servers)
  • cageFS and another FIREWALL technique installed on the server configured correctly so that the back-office is not slow by blocking external services that Prestashop uses. If in doubt, or back-office slow, please ask the provider of your accommodation if there are firewalls installed !!!

 

PS 1.7.x in detail:

PS 1.7.0 > 1.7.3. - here you can still use php 5.6.30 (above and inclusive) without problems. For better performance use php 7.1. and mysql 5.7 or maria DB 10

> PS 1.7.4. - explicitly requires php 7.2. and maria DB 10 or mysql 5.7.

 

Opcache optimization:

    opcache.revalidate_freq = 0
    opcache.validate_timestamps = 0 (comment this out in your dev environment)
    opcache.max_accelerated_files = 7963
    opcache.memory_consumption = 192
    opcache.interned_strings_buffer = 16
    opcache.fast_shutdown = 1