Jump to content

httpd process


oarecare

Recommended Posts

i have some bad-written php scripts that, when run, make apache use over 90% cpu, under 1% memory, and not die (i have changed the timeouts to 4 seconds). The process will show in 'top' for hours, until a manual apache stop - apache start. Which part of the configuration files have i written wrong?

 

 

Link to comment
https://forums.phpfreaks.com/topic/134030-httpd-process/
Share on other sites

it is set to 5... a reasonable amount

 

apparently, it was a loop that php does not resume from, even though max_execution_time passes

 

for($i=0;$i<5;$i++)

{

//some sort of database query

//calculations

$i=0;

}

 

strange, i thought max_execution_time would kill the script, but infact it won't.

Link to comment
https://forums.phpfreaks.com/topic/134030-httpd-process/#findComment-697850
Share on other sites

for($i=0;$i<5;$i++)

{

//some sort of database query

//calculations

$i=0;

}

 

 

Why would you ever do that?

 

 

While i is less than 5 {

    //do something

    //set i to 0

}

 

 

If I remember correctly, the max_execution_time is ignored by the PHP CLI.

 

You should fix your loop so the script terminates when it's done doing its thing.

 

 

Or, if you actually want it to run forever, put in a small pause to keep the CPU down.  usleep(50) or something.

Link to comment
https://forums.phpfreaks.com/topic/134030-httpd-process/#findComment-698187
Share on other sites

it's not my script. actually it worked like this:

//check how many months have passed (mysql)

for($i=0;$i<$months;$i++)

{

//blabla

$i=0;

}

 

Of course it worked for the first month...

 

it's not cli, it's cgi

 

Is there any workaround to get the server to drop it after x seconds???

 

I hate having to debug someone else's script.

Link to comment
https://forums.phpfreaks.com/topic/134030-httpd-process/#findComment-698210
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.