Hi Guys

I have a script on my linux server.However i am having an issue with php-fpm ...whatever configuration i put , the php pages take time to load.For some configuration , the php files load fast at start and over time they become slow ...after 5-9 hours its 404 found found error.

I am on a centos 64bit minimal + 8GB ram + apc + php-fpm
In an attempt to solve the problem , i enable slow_log for php-fpm
Here are the result

[29-Aug-2012 08:12:43] [pool www] pid 26362
script_filename = /usr/share/nginx/html/generate/index.php
[0x0000000002917960] ob_flush() /usr/share/nginx/html/generate/class.php:430
[0x00000000029173f8] download() /usr/share/nginx/html/generate/class.php:295
[0x00000000029161f0] stream_get() /usr/share/nginx/html/generate/index.php:26

There are many of these
Here is my index.php( i put only important parts so that not to bored u guys)

<?php

* Description: 
    - Vinaget is script generator premium link that allows you to download files instantly and at the best of your Internet speed.
    - Vinaget is your personal proxy host protecting your real IP to download files hosted on hosters like RapidShare, megaupload, hotfile...
    - You can now download files with full resume support from filehosts using download managers like IDM etc
    - Vinaget is a Free Open Source, supported by a growing community.
*/

ob_start();
error_reporting (E_ALL);
ob_implicit_flush (TRUE);
ignore_user_abort (0);
if( !ini_get('safe_mode') ){
            set_time_limit(30);
} 
define('vinaget', 'yes');
include("class.php");
$obj = new stream_get(); 

if ($obj->Deny == false && isset($_POST['urllist'])) $obj->main();
elseif(isset($_GET['infosv'])) $obj->notice();
############################################### Begin Secure ###############################################
elseif($obj->Deny == false) {
    if (!isset($_POST['urllist'])) {
        include ("hosts/hosts.php");
        asort($host);
?>
// At end u got something like this 
<?php
    } #(!$_POST['urllist'])
} 
############################################### End Secure ###############################################
ob_end_flush(); 
?>

Class.php
Line 426-430

while (!feof($fp) && (connection_status()==0)) {
            $recv = @stream_get_line($fp, $this->unit);
            @print $recv;
            @flush();
            @ob_flush();
        }
        fclose($fp);
        exit;

The script uses no hdd at all , all it needs is ram and bandwidth

UPDATE 1 :

Here is top command(was not like this before , having the php issue since 2-3 days)

 top - 11:08:38 up  2:42,  1 user,  load average: 270.37, 194.79, 106.06
 Tasks: 629 total,   1 running, 628 sleeping,   0 stopped,   0 zombie
 Cpu(s): 14.3%us, 14.3%sy,  0.0%ni,  0.0%id, 71.4%wa,  0.0%hi,  0.0%si,  0.0%st
 Mem:   8056312k total,  1857668k used,  6198644k free,    22412k buffers
 Swap:  8191992k total,        0k used,  8191992k free,   679880k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  7666 root      20   0 15420 1740  984 R 100.0  0.0   0:00.70 top
     1 root      20   0 19228 1508 1232 S  0.0  0.0   0:00.87 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.02 migration/0
     4 root      20   0     0    0    0 S  0.0  0.0   0:05.03 ksoftirqd/0
     5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
     6 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
     7 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/1
    8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/1
     9 root      20   0     0    0    0 S  0.0  0.0   8:04.02 ksoftirqd/1
    10 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/1    11 
root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/2
   12 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/2
    13 root      20   0     0    0    0 S  0.0  0.0   0:53.16 ksoftirqd/2
    14 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/2
    15 root      RT   0     0    0    0 S  0.0  0.0   0:00.03 migration/3
    16 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/3

I belive it has happen as i have enable slow log .How to know what is behind this
Its not DDos , Ram is perfect
I am on a 8GB ram server - only 1 gb is used
It keeps on increasing i need help guys

you can try to log the speed at different lines of your code. slowly narrow down to the function that takes the most time.

I already did .....slow_log shows it all
Read my post again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.