PHP Error 504 Gateway Timeout, How To Solve Problem, Maybe you have experienced a sudden program or website error 504 gateway timeout.
Next, you must change your php.ini file, which is typically located at /etc/php.ini. Search for the max_execution_time directive. Increase the value to 100000, like it.
or you can do init_set in php
504 Gateway Timeout Error on Nginx + FastCGI (php-fpm)
If you are using Nginx with FastCGI (php-fpm) then you’ll need to first make a change to your PHP-FPM file. Navigate to /etc/php5/fpm/pool.d/www.conf (may vary based on PHP version). Set the following directive:request_terminate_timeout = 300
Next, you must change your php.ini file, which is typically located at /etc/php.ini. Search for the max_execution_time directive. Increase the value to 100000, like it.
max_execution_time = 300
or you can do init_set in php
set_time_limit(0);Not only that, you can do query relation optimization.
ini_set('max_input_vars', '3000');
ini_set('post_max_size', '100M');
ini_set('upload_max_filesize', '100M');
ini_set('memory_limit', -1);
ini_set('max_input_time', -1);
ini_set('max_execution_time',-1);