Tengo un script que importa datos de un sistema a otro por lo que es un sistema que requiere de tiempo ya que traspasa casi 300.000 registros.
Para ello he creado una clase con PHP usando el framework laravel pero me sale un error 504 al ejecutar el script
Gateway Timeout The gateway did not receive a timely response from the upstream server or application.
Apache/2.4.29 (Ubuntu) Server at local Port 80
Por eso lo que hago es, en la clase del constructor setear una serie de parámetros del php , pero con todo eso me sigue saliendo el error.
El código de la clase es tal como éste:
class CarsController extends Controller
{
function __construct() {
ini_set('max_execution_time', 999999);
ini_set('max_input_time', 999999);
ini_set('default_socket_timeout', 999999);
ini_set('memory_limit','4096M');
parent::__construct();
}
public function readMigration()
{
//Realizar las acciones SQL
}
}
La configuración del php uso php7.2-fpm y tengo la siguiente
; Default timeout for socket based streams (seconds)
; http://php.net/default-socket-timeout
default_socket_timeout = 60
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 36000
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 36000
; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64
; How many GET/POST/COOKIE input variables may be accepted
; max_input_vars = 1000
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = -1
FastCgiExternalServer
.