WN

WN (https://www.wn.se/forum/index.php)
-   Serversidans teknologier (https://www.wn.se/forum/forumdisplay.php?f=4)
-   -   Ändra timeout för scripts i Apache (https://www.wn.se/forum/showthread.php?t=8536)

FredrikMH 2005-06-18 07:54

Kan man ändra timeout för specifika scripts i Apache och kan man göra det med hjälp av php, .htaccess?

Jonas 2005-06-18 08:59

Citat:

Originally posted by FredrikMH@Jun 18 2005, 07:54
Kan man ändra timeout för specifika scripts i Apache och kan man göra det med hjälp av php, .htaccess?
Det finns 3st sätt:

PHP.INI
Kod:

max_execution_time 30
.HTACCESS
Kod:

php_admin_value max_execution_time 30
I din php fil
Kod:

ini_set('max_execution_time', 30);
## TILLÄGG ##

Citat:

The maximum execution time is not affected by system calls, stream operations etc. Please see the set_time_limit() function for more details.
Citat:

When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.

Warning
set_time_limit() has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.

Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running.


FredrikMH 2005-06-18 09:48

Men om den maximala tiden på ett php script överstiger gränsen som ett script får köras av webservern så gäller webserverns inställning och inte scriptet. Jag undrar om jag kan påverkare Apache på något sätt.

kullervo 2005-06-18 11:53

Citat:

Originally posted by FredrikMH@Jun 18 2005, 08:48
Men om den maximala tiden på ett php script överstiger gränsen som ett script får köras av webservern så gäller webserverns inställning och inte scriptet. Jag undrar om jag kan påverkare Apache på något sätt.
Det finns ingen max tidsgräns en förfrågan får ta i Apache. Jobbigt när man laddar ner stora filer annars.

FredrikMH 2005-06-18 17:25

Citat:

Ursprungligen postat av kullervo
Citat:

Ursprungligen postat av FredrikMH
Men om den maximala tiden på ett php script överstiger gränsen som ett script får köras av webservern så gäller webserverns inställning och inte scriptet. Jag undrar om jag kan påverkare Apache på något sätt.

Det finns ingen max tidsgräns en förfrågan får ta i Apache. Jobbigt när man laddar ner stora filer annars.

Jo det finns det. Men det räcker att servern skickar ett paket så nollställs räknaren så det rör inte filnedladdning.

Citat:


The TimeOut directive currently defines the amount of time Apache will wait for three things:

The total amount of time it takes to receive a GET request.
The amount of time between receipt of TCP packets on a POST or PUT request.
The amount of time between ACKs on transmissions of TCP packets in responses.

We plan on making these separately configurable at some point down the road. The timer used to default to 1200 before 1.2, but has been lowered to 300 which is still far more than necessary in most situations. It is not set any lower by default because there may still be odd places in the code where the timer is not reset when a packet is sent.



Alla tider är GMT +2. Klockan är nu 07:18.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson