Error fatal: Tiempo máximo de ejecución de 30 segundos excedido


Estoy descargando un archivo JSON de una fuente en línea y cuando se ejecuta a través del bucle, recibo este error:

Error fatal: Tiempo máximo de ejecución de 30 segundos excedido en C:\wamp\www\temp\fetch.php en línea 24

 331
Author: A.L, 2011-03-02

15 answers

Su bucle puede ser interminable. Si no lo es, podría extender el tiempo máximo de ejecución de esta manera:

ini_set('max_execution_time', 300); //300 seconds = 5 minutes
 597
Author: Michiel Pater,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-02 08:14:09

Tuve el mismo problema y lo resolví cambiando el valor para el parámetro max_execution_time en php.ini, así:

max_execution_time = 360      ; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)
max_input_time = 120          ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 128M           ; Maximum amount of memory a script may consume (128MB by default)

Espero que esto pueda ayudarte.

 163
Author: Güilber J. Castillo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-25 12:14:06

Todas las respuestas anteriores son correctas, pero utilizo una forma sencilla de evitarlo en algunos casos.

Simplemente ponga este comando al principio de su script:

set_time_limit(0);
 44
Author: Massa,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-24 19:14:19

Me encontré con este problema al actualizar a WordPress 4.0. Por defecto WordPress limita el tiempo máximo de ejecución a 30 segundos.

Agregue el siguiente código a su .htaccess archivo en el directorio raíz de su Instalación de WordPress para reemplazar el valor predeterminado.

php_value max_execution_time 300  //where 300 = 300 seconds = 5 minutes
 18
Author: Fahim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-22 14:30:52

Editar php.ini

Encuentra esta línea:

max_execution_time

Cambie su valor a 300:

max_execution_time = 300

300 significa 5 minutos de tiempo de ejecución para la solicitud http.

 17
Author: Jamil Ahmed,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-25 16:35:38

Su script se está agotando. Echa un vistazo a la función set_time_limit () para aumentar el tiempo de ejecución. O perfile el script para que se ejecute más rápido:)

 15
Author: tlenss,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-19 09:19:26

Si todo lo anterior no funcionó para usted, agregue un archivo .htaccess al directorio donde se encuentra su script y colóquelo dentro de

<IfModule mod_php5.c>
php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>

Esta fue la forma en que resolví mi problema , ni ini_set('max_execution_time', 86400); ni set_time_limit(86400) resuelto mi problema , pero el .el método htaccess lo hizo.

 11
Author: Nassim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-09 13:25:21

Podemos resolver este problema de 3 maneras diferentes.

1) Usando php.ini file

2) Utilizando .htaccess file

3) Usando Wp-config.archivo php (para Wordpress)

Para más detalles - > steptoinstall

 9
Author: KarSho,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-25 11:25:14

Puede eliminar la restricción poniéndola a cero añadiendo esta línea en la parte superior de su script:

<?php ini_set('max_execution_time', 0); ?>
 8
Author: Mwangi Thiga,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-22 06:40:48

Siga la ruta /etc/php5(your php version)/apache2/php.ini.

Ábrelo y establece el valor de max_execution_time a uno deseado.

 7
Author: Suchit kumar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-06-22 19:45:46

Tal vez busque cualquier cosa que haya cambiado bajo php.archivo ini. Por ejemplo, cambié "; intl.default_locale = " to "; intl.default_locale = en_utf8 " para habilitar la "extensión de internacionalización (Intl)" sin agregar la extensión "=php_intl.dll " entonces ocurrió este mismo error. Así que sugiero comprobar si hay errores similares.

 7
Author: MikeGte,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-21 06:22:56

Puedes hacerlo fácilmente con whm . jusst llegó a whm - - - - - >configuración del servicio---------->editor de configuración php - - - - - - - max_execution_time - - - - - >30 (es por defecto cambiarlo a cualquier valor que desee)

 5
Author: payal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-27 03:07:04

Para extender su max_execution_time usted puede utilizar cualquiera de los ini_set o set_time_limit.

// Set maximum execution time to 10 seconds this way
ini_set('max_execution_time', 10);
// or this way
set_time_limit(10);

!! Pero tenga en cuenta que, ambas funciones se reinicia también contando el tiempo script ya ha tomado para ejecutar

sleep(2);
ini_set('max_execution_time', 5);

register_shutdown_function(function(){
    var_dump(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']);
});

for(;;);

//
// var_dump outputs float(7.1981489658356)
//

Entonces, si desea establecer la cantidad máxima exacta de tiempo que el script puede ejecutarse, su comando debe ser el primero.

Las diferencias entre esas dos funciones son

  • set_time_limit no devuelve información sobre si tuvo éxito, pero lanzará una advertencia de error.
  • ini_set devuelve el valor antiguo en caso de éxito, o false en caso de error sin ninguna advertencia/error
 5
Author: Buksy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-27 13:35:23

Aumente el tiempo de ejecución de su script agregando la siguiente línea en la parte superior del script PHP.

ini_set('max_execution_time', 120); //120 seconds = 2 minutes

La referencia ha tomado de Aumentar el Tiempo de Ejecución del Script PHP

 3
Author: JoyGuru,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-22 18:39:30

Tengo el mismo problema en el sitio de WordPress, He añadido .el archivo htaccess entonces funciona bien para mí.

php_value max_execution_time 6000000
 2
Author: Ankit K Gupta,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-18 09:56:42