A
A
Alexander Chibilyaev2017-01-22 11:30:39
PHP
Alexander Chibilyaev, 2017-01-22 11:30:39

How to fix 504 server error due to prestashop?

In Prestashop's admin area, there is a "REGENERATE Thumbnails" section.
Like when you try to recreate both all the pictures at once, and separately (images, formats), even without deleting old images (Delete old images - NO), the server crashes in 504.
How to fix this problem?
Server:
4 cores 1200MHz
RAM: 8GB
HDD: 80GB SSD
Added execution time in php, apache and nginx to 600 seconds, but the error appears after 60. For some reason, nginx does not accept parameters. - Didn't work
Compressed images without loss of quality with linux utility, regenerated images, still 504
Maybe there is some batch tool in Prestashop to recreate thumbnails?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ITLandgraf, 2017-01-23
@ITLandgraf

If the server is your own, then it will be easier to deal with the max_execution_time parameter. On hosting, this parameter should not be increased more than 120 seconds (usually).
You can try to run the _regenerateThumbnails function from controllers/admin/AdminImagesController.php via the console by packing it into a file:

<?php
//в корень сайта!!!
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');

_regenerateThumbnails('all', true);
 
echo 'Done!';
?>

This code has not been tested.
Or you can make the _regenerateThumbnails function work only for an ID interval - one that does not cause a timeout on the server. And change this interval. For example, first 1-500, 501-1000, etc.
I did it, it works.

T
teet, 2017-01-22
@teet

I suggest looking in the code for a method that recreates thumbnails and write a php script that uses this method (I did this for open real estate cms ). Run everything in console.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question