1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Server load script not working since plesk 8 upgrade

Discussion in 'Plesk for Linux - 8.x and Older' started by jubbs, May 24, 2006.

  1. jubbs

    jubbs Guest

    0
     
    Hi guys,
    We have a server load script written in php that was/is working on our Plesk 7.5 servers. We upgraded one server to Plesk 8 and that same script now doesnt work.

    Is there an alternative load script, or modification we can make to get it working?

    Here is the code:

    PHP:
    <?php

    // Get The Server Load
    function get_ServerLoad()
        {
            if(
    PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
                if(
    file_exists('/proc/loadavg') ) {
                    if (
    $fh = @fopen'/proc/loadavg''r' )) {
                        
    $data = @fread$fh);
                        @
    fclose$fh );
                        
    $load_avg explode" "$data );
                        
    $server_load trim($load_avg[0]);
                    }
                } else {
                    
    $data = @system('uptime');
                    
    preg_match('/(.*):{1}(.*)/'$data$matches);
                    
    $load_arr explode(','$matches[2]);
                    
    $server_load trim($load_arr[0]);
                }
            }
            if(!
    $server_load) {
                
    $server_load 'N/A';
            }
            return 
    $server_load;
        } 

    echo 
    get_ServerLoad();

    ?>
     
  2. eilko

    eilko Regular Pleskian

    28
    73%
    Joined:
    Aug 1, 2001
    Messages:
    468
    Likes Received:
    4
    Location:
    Enschede, Netherlands
    Plesk8 has enabled php safemode for all domains. With safe mode on you can't access /proc/ . Disable safe mode or add /proc to the openbasedirpath.
     
Loading...