Page 1 of 1

Need help with while loop

Posted: Fri Aug 27, 2004 1:51 am
by kholloi
Hi,
I am trying to write a php script that will display all active ethernet interfaces on my Linux server. I am using passthru() to pass shell commands to the system and then sed to trim the output. Now thee might be more than one active interace and the challenge is to have them displayed one at a time.
THis is what I have done so far:

Code: Select all

$int = 0;
while ($int <=3);
&#123;
passthru("/sbin/ifconfig eth$int | sed -n '1,2p' ");
$int ++;
&#125;
THis is the error I get though:

Fatal error: Maximum execution time of 30 seconds exceeded in /srv/www/htdocs/admn/network.php on line 51

IS there an obvious flaw in my code or am I missing something else here?

Thanks

Posted: Fri Aug 27, 2004 2:18 am
by AngusL
I'd assume, from my limited knowledge, that it is taking too long to get the results from the shell, I believe there is a MAX_EXECUTION_TIME or similar in the php.ini that needs to be increased from 30 seconds.

I think...

Posted: Fri Aug 27, 2004 4:31 am
by kholloi
THanks,

It is fine now