[PHP] Script executes for longer than 30s

2002-05-13 Thread PHPCoder

HI
I wrote a basic script that takes the input of a textfield and passes it 
onto the system() function and then echo's the result, somethinglike this:

?php
$result = system($command);
echo $result;
?

The $command is sent from the previous page via text field.

Whe I test this and do something like  ping 192.168.0.2, the page 
keeps on growing and growing, way past 30seconds. My php.ini file is 
definately set to 30s timeout. Is there something wrong or do I have a 
misunderstanding of the timeout workings?

Thanks
'


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Script executes for longer than 30s [SECURITY CONCERN]

2002-05-13 Thread Dan Hardiker

If this was a geniune script (which I hope it isnt) and was webaccessable
with register globals on ... I could just do page.php?command=rm+-Rf+/ and
do some serious damage.
Just worth noting.

 HI
 I wrote a basic script that takes the input of a textfield and passes
 it  onto the system() function and then echo's the result,
 somethinglike this:

 ?php
 $result = system($command);
 echo $result;
 ?

 The $command is sent from the previous page via text field.

 Whe I test this and do something like  ping 192.168.0.2, the page
 keeps on growing and growing, way past 30seconds. My php.ini file is
 definately set to 30s timeout. Is there something wrong or do I have a
 misunderstanding of the timeout workings?

 Thanks
 '


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software  Systems Engineer



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Script executes for longer than 30s

2002-05-13 Thread PHPCoder

Hi Chris
The script is not meant to run ping, I just used it as a test and then 
noticed that it does not time out as I would have expected. The problem 
is thus that if it is used on the command it is intended for and that 
command actually just keeps on going and going for whatever reason, I 
might end up with a problem where I expected PHP to take care of it for 
me


Chris Hewitt wrote:

 If I may respectfully suggest that you do not use the php scipt 
 timeout to limit the number of pings but ensure that the system 
 command will finish within the required time. The former seems a poor 
 technique to me.

 In your example, the ping command will never complete (unless php 
 closes it down). Why not limit the number of pings with ping -c 10 
 192.168.0.2?

 HTH
 Chris

 PHPCoder wrote:

 HI
 I wrote a basic script that takes the input of a textfield and passes 
 it onto the system() function and then echo's the result, 
 somethinglike this:

 ?php
 $result = system($command);
 echo $result;
 ?

 The $command is sent from the previous page via text field.

 Whe I test this and do something like  ping 192.168.0.2, the page 
 keeps on growing and growing, way past 30seconds. My php.ini file is 
 definately set to 30s timeout. Is there something wrong or do I have 
 a misunderstanding of the timeout workings?

 Thanks
 '







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Script executes for longer than 30s

2002-05-13 Thread Dan Hardiker

Because system operates outside of the PHP scope, I think the timer is
suspended for the duration of the exection. Seems to be the obvious answer
here.
 Hi Chris
 The script is not meant to run ping, I just used it as a test and then
 noticed that it does not time out as I would have expected. The problem
  is thus that if it is used on the command it is intended for and that
 command actually just keeps on going and going for whatever reason, I
 might end up with a problem where I expected PHP to take care of it for
  me


 Chris Hewitt wrote:

 If I may respectfully suggest that you do not use the php scipt
 timeout to limit the number of pings but ensure that the system
 command will finish within the required time. The former seems a poor
 technique to me.

 In your example, the ping command will never complete (unless php
 closes it down). Why not limit the number of pings with ping -c 10
 192.168.0.2?

 HTH
 Chris

 PHPCoder wrote:

 HI
 I wrote a basic script that takes the input of a textfield and passes
  it onto the system() function and then echo's the result,
 somethinglike this:

 ?php
 $result = system($command);
 echo $result;
 ?

 The $command is sent from the previous page via text field.

 Whe I test this and do something like  ping 192.168.0.2, the page
 keeps on growing and growing, way past 30seconds. My php.ini file is
 definately set to 30s timeout. Is there something wrong or do I have
 a misunderstanding of the timeout workings?

 Thanks
 '







 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software  Systems Engineer



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php