[SOLVED] Need help with while loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kholloi
Forum Newbie
Posts: 19
Joined: Tue Mar 30, 2004 1:08 am

Need help with while loop

Post 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
AngusL
Forum Contributor
Posts: 155
Joined: Fri Aug 20, 2004 4:28 am
Location: Falkirk, Scotland

Post 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...
kholloi
Forum Newbie
Posts: 19
Joined: Tue Mar 30, 2004 1:08 am

Post by kholloi »

THanks,

It is fine now
Post Reply