Page 1 of 1

execution time problem

Posted: Wed Oct 31, 2007 9:53 am
by itsmani1
Hi

I want to set execution time of script like if want execute a script for 200 seconds and for other scripts it should be normal as fixed in configuration is it possible.

Like if have file a.php and file b.php
i want to set time 200 seconds for a.php
and for b.php i want to work normally as set in php settings

Please suggest me solution

Note: my server is shared.

thank you

Posted: Wed Oct 31, 2007 9:55 am
by John Cartwright
set_time_limit()

Posted: Wed Oct 31, 2007 9:56 am
by itsmani1
Jcart wrote:set_time_limit()
do you think this will work considering i don't have dedicated server?

thank you

Posted: Wed Oct 31, 2007 9:57 am
by John Cartwright
yes

Posted: Wed Oct 31, 2007 10:01 am
by VladSun
Or by using .htaccess

Code: Select all

php_value max_execution_time "200"

Posted: Wed Oct 31, 2007 10:04 am
by itsmani1
thank you

one last question

can i set it for one script file or this will be for whole folder or dir?

and also Please see the code:

Code: Select all

$i=1;
while($i > 0)
{
 echo 'yes<BR/>';
}
i want the above code to run only 200 seconds and after that it should exit

is this possible?


thanks

Posted: Wed Oct 31, 2007 10:13 am
by VladSun
I haven't done this before but it should work. Use

http://httpd.apache.org/docs/2.0/mod/core.html#files

instead of <Directory> directive

Posted: Wed Oct 31, 2007 10:57 am
by Kieran Huggins
Timing out seems like a bit of a hack to me, but the alternative of checking the time every loops seems somewhat worse.

Maybe you could use a cron job? Or fork a process?