473,805 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

apache +php +time limits

Hello
I set max_execution_t ime 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 < 100000000000000 000000000000000 00000000000; $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 5538
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_t ime 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 < 100000000000000 000000000000000 00000000000; $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_ex ecution_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_t ime 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 < 100000000000000 000000000000000 00000000000; $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_ex ecution_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*******@attgl obal.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*******@attg lobal.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
1780
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 ? If I do /usr/sbin/apachectl extendedstatus command, I got this. =============================================================================== * * * Apache Server Status for noname.com
3
2321
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 Apache isn't processing the PHP pages! What's going on here? Somebody can help me ? If I do /usr/sbin/apachectl extendedstatus command, I got this. =============================================================================== * * *
2
14171
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 Smarty-2.6.7.tar.gz on a system running WindowsXP SP2. Apache and PHP tested out fine. After adding Smarty, I ran the following http://localhost/testphp.php
2
1556
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 do large-scale sites with PHP they scale these numbers up. If you have a content management system running every aspect of a large corporate web site, including a database back end that employees use for important, secret, protected information,...
3
3223
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 to configure them on my computer. Can somebody help me - this is what I have done so far. Installed Apache 2.0, it worked perfectly ( I checked with my browser - http://localhost) till the point where I started to point where I
18
2404
by: rfhurley | last post by:
How do I run a .php program? (I'm starting with the "hello world" script)
5
13897
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 type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" />
6
7983
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 "include not found", rather much of the page is blank where the included menus, etc would be, and the CSS is not attached. thanks so much!!! My httpd.conf looks like this:
5
2865
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 and then stops or refreshes the browser before the script had time to finish will Apache kill the script mid execution or will it let it finish ? I ask this stupid question because this seems to be happening in one
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10613
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.