473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

apache +php +time limits

Hello
I set max_execution_time to 30 in php.ini file (i also checked in
phpinfo). max_input_time is set to 45.

But when I use in script something like that:

while ( 1 == 1 )
or
for ( $i=0; $i < 10000000000000000000000000000000000000000; $i++)

{
echo "\n".$i;
}
it doesn't work - execution of script lasts for unlimited time.

of course I executed it via apache (I read that this limit doesn't work
while executing in console)

is it bug or am i doing something wrong?

regards
nichu
Nov 17 '08 #1
9 5515
did you restart the server after setting the max execution time?
Nov 17 '08 #2
macca wrote:
did you restart the server after setting the max execution time?
of course ... YES - i restarted ...
Nov 18 '08 #3
Nichu escribió:
I set max_execution_time to 30 in php.ini file (i also checked in
phpinfo). max_input_time is set to 45.

But when I use in script something like that:

while ( 1 == 1 )
or
for ( $i=0; $i < 10000000000000000000000000000000000000000; $i++)

{
echo "\n".$i;
}
it doesn't work - execution of script lasts for unlimited time.

of course I executed it via apache (I read that this limit doesn't work
while executing in console)
I suppose you've already checked the most obvious things (restart web
server, run phpinfo() to see if your settings have been applied...).

An alternative could be to use this in the code itself:

<?php
ini_set('max_execution_time', 30); // Seconds
while(TRUE){
}
?>

It works for me where editing php.ini doesn't (e.g. console).
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Nov 18 '08 #4
Álvaro G. Vicario wrote:
Nichu escribió:
>I set max_execution_time to 30 in php.ini file (i also checked in
phpinfo). max_input_time is set to 45.

But when I use in script something like that:

while ( 1 == 1 )
or
for ( $i=0; $i < 10000000000000000000000000000000000000000; $i++)

{
echo "\n".$i;
}
it doesn't work - execution of script lasts for unlimited time.

of course I executed it via apache (I read that this limit doesn't
work while executing in console)

I suppose you've already checked the most obvious things (restart web
server, run phpinfo() to see if your settings have been applied...).

An alternative could be to use this in the code itself:

<?php
ini_set('max_execution_time', 30); // Seconds
while(TRUE){
}
?>

It works for me where editing php.ini doesn't (e.g. console).

of course I checked phpinfo - i also checked ini_get - and both methods
show me good value (the one I set in php.ini)

ini_set works for me - but i want to limit execution time for all my
users - and rather if I tell them to add this line to their scripts they
won't listen to me ;)

so I need to do it via php.ini

Nov 18 '08 #5
Nichu escribió:
ini_set works for me - but i want to limit execution time for all my
users - and rather if I tell them to add this line to their scripts they
won't listen to me ;)

so I need to do it via php.ini
Weird... What OS and server API are you using?
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Nov 18 '08 #6
Álvaro G. Vicario wrote:
Nichu escribió:
>ini_set works for me - but i want to limit execution time for all my
users - and rather if I tell them to add this line to their scripts
they won't listen to me ;)

so I need to do it via php.ini

Weird... What OS and server API are you using?

uppps
it was wrong diagnosis :/ sorry for that...
generally limit works but it doesn't last for time specified in php.ini
and it lasts ... well rather quite randomly ...

when I set the limit to lower value (3 seconds) firstly it stopped
script after 7 seconds, 2nd time after ~12 seconds, 3rd time ~9 seconds
and later it last really long (after 25 seconds I stopped it manually)

probably it has something common with caching but generally sometimes it
lets script working for really long time (much longer than limit in
php.ini stands for)

by the way i'm testing it on mandriva, debian and gentoo...

regards
nichu
Nov 18 '08 #7
Nichu wrote:
Álvaro G. Vicario wrote:
>Nichu escribió:
>>ini_set works for me - but i want to limit execution time for all my
users - and rather if I tell them to add this line to their scripts
they won't listen to me ;)

so I need to do it via php.ini

Weird... What OS and server API are you using?


uppps
it was wrong diagnosis :/ sorry for that...
generally limit works but it doesn't last for time specified in php.ini
and it lasts ... well rather quite randomly ...

when I set the limit to lower value (3 seconds) firstly it stopped
script after 7 seconds, 2nd time after ~12 seconds, 3rd time ~9 seconds
and later it last really long (after 25 seconds I stopped it manually)

probably it has something common with caching but generally sometimes it
lets script working for really long time (much longer than limit in
php.ini stands for)

by the way i'm testing it on mandriva, debian and gentoo...

regards
nichu
3 seconds does not necessarily mean 3 real-time seconds. It means at
least 3 seconds of cpu time - which varies in real life, depending on
what else is going on in the system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 18 '08 #8
>generally limit works but it doesn't last for time specified in php.ini
>and it lasts ... well rather quite randomly ...
As I understand it, the execution time limit is in CPU seconds, not
wall clock seconds, and only for the PHP process. So if your script
is doing a lot of stuff that doesn't occupy much CPU (*in PHP*),
such as disk I/O, network I/O, DNS lookups, or database calls, it
may last quite a bit longer.
>when I set the limit to lower value (3 seconds) firstly it stopped
script after 7 seconds, 2nd time after ~12 seconds, 3rd time ~9 seconds
and later it last really long (after 25 seconds I stopped it manually)

probably it has something common with caching but generally sometimes it
lets script working for really long time (much longer than limit in
php.ini stands for)
Nov 19 '08 #9
Michael Vilain wrote:
In article <ad********************************@4ax.com>,
nadia <no****@example.comwrote:
>On Tue, 18 Nov 2008 07:29:48 -0500, Jerry Stuckle <js*******@attglobal.net>
wrote:
>>3 seconds does not necessarily mean 3 real-time seconds. It means at
least 3 seconds of cpu time - which varies in real life, depending on
what else is going on in the system.
Really?
Can you tell me where that is documented lease?
(I've never heard of a timer using the CPU before)

nadia.

You didn't look very far:

http://www.php.net/manual/en/functio...time-limit.php
Pull up that page and search for 'CPU', it's there for sure. Thanks for
a lil bit of knowledge ill need down the road.
Nov 20 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jean-Louis Vill | last post by:
=============================================================================== I installed PHP from an RPM, but Apache isn't processing the PHP pages! What's going on here? Somebody can help me ?...
3
by: Jean-Louis Vill | last post by:
I did a mistake with the files name (http.conf ==> httpd.conf). See at the end. =============================================================================== I installed PHP from an RPM, but...
2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
2
by: lkrubner | last post by:
PHP comes with certain defaults, set in php.ini. Among these, scripts time out after 60 seconds, I think. The default memory limit for a script is, I believe, 8 megs. I assume that when people...
3
by: genenamg | last post by:
Hi, I am trying to run and configure Apache 2.0, php 5 and mysql on win xp professional - this is the first time I have tried to install and configure all three. I am having difficulty trying...
18
by: rfhurley | last post by:
How do I run a .php program? (I'm starting with the "hello world" script)
5
chunk1978
by: chunk1978 | last post by:
hi there... i have the following codes (HTML and PHP) on my Apache Localhost: HTML: titled "Form.html" <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
5
by: Guillermo Antonio Amaral Bastidas | last post by:
Hi everybody, I have a quick and probably dumb question, keep in mind I just dumped my old love FastCGI + Perl for it's younger hotter friend PHP5. If the user calls a time consuming script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.