PHP Classes

Pimped Apache Status: Display the requests handled by an Apache server

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 224 All time: 8,230 This week: 102Up
Version License PHP version Categories
pimped-apache-status 1.28GNU General Publi...5.0HTTP, PHP 5, System information
Description 

Author

This package can be used to display the requests handled by an Apache web server.

It can parse the output of the regular Apache server status page to extract statistics of the Apache server resources usage as well details of the HTTP requests being currently handled.

The package renders the information in a way that is more readable than the regular server status page and allows to search and sort the listings.

It can merge the status of several servers that opens the possibility to identify a troubleshooter even on a load balanced Web site.

The Web based tool offers a multi-language, skinnable interface with a built-in updater.

It can also have several views, like for instance most requested files, domains, methods, most active IP, as well can export all views as JSON, XML or CSV.

Innovation Award
PHP Programming Innovation award nominee
July 2015
Number 7
The Apache Web server comes with a module that can show the status of the Web server instance and the requests that it is serving.

However, the way that module presents the information is not very easy to understand and it is hard to figure certain types of information that would be helpful to determine the "health" of the Web server.

This class provides an alternative user interface to view the status of one or more Apache Web servers in a more readable way with the possibility to search and sort several types of listings.

Manuel Lemos
Picture of Axel Hahn
  Performance   Level  
Name: Axel Hahn <contact>
Classes: 5 packages by
Country: Switzerland Switzerland
Age: 52
All time rank: 267826 in Switzerland Switzerland
Week rank: 164 Up3 in Switzerland Switzerland Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php

/*
 * PIMPED APACHE-STATUS
 *
 * view: update
 */

$sApproot=dirname(__DIR__);
$sZipfile = getTempdir() . '/__pimpapachestat-latest.zip';
$sTargetPath = $sApproot;
$sLatestUrl=$aEnv["links"]["update"]['download']['url'];

if (!
array_key_exists('doinstall', $_GET)) {
   
// ------------------------------------------------------------
    // step 1: welcome
    // ------------------------------------------------------------
   
$sUpdateInfo=checkUpdate(true);
   
$content = '<h3 id="h3' . md5($sServer) . '">' . $aUserCfg['icons']['update.php'] .' '. $aLangTxt["lblUpdate"] . '</h3>'
           
. '<div class="subh3"><br>'
           
. (hasNewVersion($sUpdateInfo)
                ?
' '.$aLangTxt['lblUpdateNewerVerionAvailable'].'<br>'
               
:'<div class="hintbox">'.$aLangTxt['lblUpdateNoNewerVerionAvailable'].'</div>'
               
)
            .
'<br>'
           
. sprintf($aLangTxt["lblUpdateHints"], $sLatestUrl)
            .
'</div>'
           
. '<a href="' . getNewQs(array('doinstall' => 'download')) . '"'
           
. ' class="btn btn-default"'
           
. '>' . $aLangTxt["lblUpdateContinue"] . '</a>';
} else {
    switch (
$_GET['doinstall']) {
       
       
// ------------------------------------------------------------
        // step 2: download
        // ------------------------------------------------------------
       
case 'download':
           
$content = '<h3 id="h3' . md5($sServer) . '">' . $aUserCfg['icons']['update.php'] .' '. $aLangTxt["lblUpdate"] . '</h3>'
                   
. '<div class="subh3">';


            if (
file_exists($sZipfile)) {
               
unlink($sZipfile);
            }
           
           
$sLatestVersionUrl = httpFollowUrl($sLatestUrl);
           
           
$content.= $sLatestUrl . '<br> --&gt; GET ' . $sLatestVersionUrl;
           
$sData = httpGet($sLatestVersionUrl);
           
$content.=' ('.strlen($sData) . ')<br>';
       
            if (
strlen($sData) > 100000) {
               
file_put_contents($sZipfile, $sData);
                if (
file_exists($sZipfile)) {
                   
$content.='<br><strong>'.$aLangTxt['lblUpdateDonwloadDone'].'</strong>'
                           
. '</div><a href="' . getNewQs(array('doinstall' => 'unzip')) . '"'
                           
. ' class="btn btn-default"'
                           
. '>' . $aLangTxt["lblUpdateContinue"] . '</a>';
                } else {
                   
$content.=$aLangTxt['lblUpdateDonwloadFailed'] . '</div>';
                }
            } else {
               
$content.=$aLangTxt['lblUpdateDonwloadFailed'] . '</div>';
            }

            break;
           
       
// ------------------------------------------------------------
        // step 3: unzip downloaded file
        // ------------------------------------------------------------
       
case 'unzip':
           
$content = '<h3 id="h3' . md5($sServer) . '">' . $aUserCfg['icons']['update.php'] .' '. $aLangTxt["lblUpdate"] . '</h3>'
                   
. '<div class="subh3">';
           
$content.=sprintf($aLangTxt['lblUpdateUnzipFile'], $sZipfile, $sTargetPath) . '<br><br>';
           
           
$zip = new ZipArchive;
           
           
$res = $zip->open($sZipfile);
            if (
$res === TRUE) {
               
// extract it to the path we determined above
               
$zip->extractTo($sTargetPath);
               
$zip->close();
               
$content.=$aLangTxt['lblUpdateUnzipOK'] . '</div>'
                   
. '<a href="?"'
                       
. ' class="btn btn-default"'
                       
. '>' . $aLangTxt["lblUpdateContinue"] . '</a>';
               
unlink($sZipfile);
            } else {
               
$content.=$aLangTxt['lblUpdateUnzipFailed'] . '</div>';
            }
            break;
       
/*
        case 'postunzip':
            $content = '<h3 id="h3' . md5($sServer) . '">' . $aLangTxt["lblUpdate"] . '</h3>'
                    . '<div class="h3">';
            $content.='</div>';
            break;
        */
       
default:
            break;
    }
}


echo
$content;


Details

---------------------------------------------------------------------- Axel pimped the Apache-status http://www.axel-hahn.de/apachestatus.php http://sourceforge.net/projects/pimpapachestat/ GNU GPL v 3.0 ---------------------------------------------------------------------- ABOUT The default apache status shows you information about current Apache activity. But these server-status pages are difficult to read. The pimped Apache status makes the Apache server status readable, sortable and searchable. The pimped Apache status can merge the status of several servers that opens the possibility to identify the troubleshooter in a load balanced website much more easily. Btw: I use the script to fetch the status from 8 servers. The output uses jQuery and the plugin datatable to search and sort the data. LICENSE GNU GPL v 3.0 REQUIREMENTS * On the system you want to install the pimped Apache status: - any webserver with php 5 (with curl; no database is needed) * On all webservers you want to monitor: - apache 2.x - installed module mod_status and ExtendedStatus On - permission for the monitoring server to request the the alias /server-status (see below) INSTALL 1. Extract the files somewhere below webroot on your webserver. You can put to any subdirectory. It is not a must to have it in the webroot. -- OR -- checkout sources with svn client: cd [webroot-directory] svn checkout http://svn.code.sf.net/p/pimpapachestat/code/trunk apachestatus 2. Allow your server to access the server-status page on the systems you want to monitor <Location /server-status> SetHandler server-status order deny, allow allow from 127.0.0.1 allow from 192.168.123.4 # enter ip of your monitoring system deny from all </Location> 3. Open http://localhost/apachestatus/ in your webbrowser. 4. In ./conf/ directory: open config_user.php and setup the systems you want to monitor. See config_default.php to see other thing you could override CUSTOMIZATION * change or add language: see readme in subdirectory ./lang/ * change theme: - make copy ./templates/default/ - make changes in style.css and out_html.php in your copy - set skin in ./conf/config_user.php: $aUserCfg = array( 'skin' => 'name_of_subdir', ); If you have a language or a theme to share then send it to me. ----------------------------------------------------------------------

Screenshots (4)  
  • export_table.png
  • history-popup.png
  • most-often-processed-requests.png
  • startpage.png
  Files folder image Files (99)  
File Role Description
Files folder imageadmin (1 file)
Files folder imageclasses (15 files)
Files folder imageconfig (6 files)
Files folder imagedocs (4 files)
Files folder imageimages (5 files)
Files folder imagejavascript (3 files, 3 directories)
Files folder imagelang (5 files)
Files folder imagetemplates (4 directories)
Files folder imagetmp (1 file)
Files folder imageviews (9 files, 1 directory)
Accessible without login Plain text file history.txt Data Documentation
Accessible without login Plain text file inc_config.php Example Example script
Accessible without login Plain text file inc_functions.php Aux. Sample output
Accessible without login Plain text file inc_menu.php Aux. Auxiliary script
Accessible without login Plain text file inc_pagetemplate.php Example Example script
Accessible without login Plain text file index.php Example Sample output
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file readme.txt Doc. Documentation
Accessible without login Plain text file upgrade.php Example Example script

  Files folder image Files (99)  /  admin  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (99)  /  classes  
File Role Description
  Plain text file ahwi-installer.class.php Class Class source
  Plain text file array2xml.class.php Class Class source
  Plain text file cdnorlocal-admin.class.php Class Class source
  Plain text file cdnorlocal.class.php Class Class source
  Plain text file configdata.class.php Class Class source
  Plain text file confighandler.class.php Class Class source
  Plain text file configserver.class.php Class Class source
  Accessible without login Plain text file data.tpl.php Data Configuration script
  Plain text file datarenderer.class.php Class Class source
  Accessible without login Plain text file html-bak.tpl.php Aux. Auxiliary script
  Accessible without login Plain text file html.tpl.php Data Configuration script
  Plain text file logger.class.php Class Class source
  Plain text file page.class.php Class Class source
  Plain text file primitivelogger.class.php Class Class source
  Plain text file serverstatus.class.php Class Class source

  Files folder image Files (99)  /  config  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file config_default.php Conf. Configuration script
  Accessible without login Plain text file config_user_default.php Conf. Example script
  Accessible without login Plain text file internal-config_default.json Data Auxiliary data
  Accessible without login Plain text file internal-config_form.json Data Auxiliary data
  Accessible without login Plain text file internal-env.json Data Auxiliary data

  Files folder image Files (99)  /  docs  
File Role Description
  Accessible without login HTML file simpledoc_datarenderer.html Doc. Documentation
  Accessible without login HTML file simpledoc_page.html Doc. Documentation
  Accessible without login HTML file simpledoc_primitivelogger.html Doc. Documentation
  Accessible without login HTML file simpledoc_serverstatus.html Doc. Documentation

  Files folder image Files (99)  /  images  
File Role Description
  Accessible without login Image file sort_asc.png Icon Icon image
  Accessible without login Image file sort_asc_disabled.png Icon Icon image
  Accessible without login Image file sort_both.png Icon Icon image
  Accessible without login Image file sort_desc.png Icon Icon image
  Accessible without login Image file sort_desc_disabled.png Icon Icon image

  Files folder image Files (99)  /  javascript  
File Role Description
Files folder imagebootstrap3 (2 directories)
Files folder imagedatatables (1 directory)
Files folder imagefont-awesome (1 directory)
  Accessible without login Plain text file counterhistory.class.js Data Auxiliary data
  Accessible without login Plain text file functions.js Data Auxiliary data
  Accessible without login Plain text file functions.min.js Data Auxiliary data

  Files folder image Files (99)  /  javascript  /  bootstrap3  
File Role Description
Files folder imagecss (2 files)
Files folder imagejs (2 files)

  Files folder image Files (99)  /  javascript  /  bootstrap3  /  css  
File Role Description
  Accessible without login Plain text file bootstrap-theme.min.css Data Sample output
  Accessible without login Plain text file bootstrap.min.css Data Sample output

  Files folder image Files (99)  /  javascript  /  bootstrap3  /  js  
File Role Description
  Accessible without login Plain text file bootstrap.min.js Data Sample output
  Accessible without login Plain text file npm.js Data Sample output

  Files folder image Files (99)  /  javascript  /  datatables  
File Role Description
Files folder imagemedia (3 directories)

  Files folder image Files (99)  /  javascript  /  datatables  /  media  
File Role Description
Files folder imagecss (1 file)
Files folder imageimages (6 files)
Files folder imagejs (2 files)

  Files folder image Files (99)  /  javascript  /  datatables  /  media  /  css  
File Role Description
  Accessible without login Plain text file jquery.dataTables.min.css Data Sample output

  Files folder image Files (99)  /  javascript  /  datatables  /  media  /  images  
File Role Description
  Accessible without login Image file favicon.ico Data Auxiliary data
  Accessible without login Image file sort_asc.png Output Sample output
  Accessible without login Image file sort_asc_disabled.png Output Sample output
  Accessible without login Image file sort_both.png Output Sample output
  Accessible without login Image file sort_desc.png Output Sample output
  Accessible without login Image file sort_desc_disabled.png Output Sample output

  Files folder image Files (99)  /  javascript  /  datatables  /  media  /  js  
File Role Description
  Accessible without login Plain text file jquery.dataTables.min.js Data Sample output
  Accessible without login Plain text file jquery.js Data Sample output

  Files folder image Files (99)  /  javascript  /  font-awesome  
File Role Description
Files folder imagecss (1 file)

  Files folder image Files (99)  /  javascript  /  font-awesome  /  css  
File Role Description
  Accessible without login Plain text file font-awesome.min.css Data Sample output

  Files folder image Files (99)  /  lang  
File Role Description
  Accessible without login Plain text file de.js Data Auxiliary data
  Accessible without login Plain text file de.php Conf. Sample output
  Accessible without login Plain text file en.js Data Sample output
  Accessible without login Plain text file en.php Conf. Sample output
  Accessible without login Plain text file readme.txt Doc. Documentation

  Files folder image Files (99)  /  templates  
File Role Description
Files folder imagedata (1 file)
Files folder imagedefault (4 files)
Files folder imageice (2 files, 1 directory)
Files folder imagesummer (2 files)

  Files folder image Files (99)  /  templates  /  data  
File Role Description
  Accessible without login Plain text file out_html.php Example Sample output

  Files folder image Files (99)  /  templates  /  default  
File Role Description
  Accessible without login Plain text file out_html.php Aux. Sample output
  Accessible without login Plain text file requests.css Data Sample output
  Accessible without login Plain text file style.css Data Sample output
  Accessible without login Plain text file style.min.css Data Auxiliary data

  Files folder image Files (99)  /  templates  /  ice  
File Role Description
Files folder imageimages (7 files)
  Accessible without login Plain text file out_html.php Example Sample output
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files (99)  /  templates  /  ice  /  images  
File Role Description
  Accessible without login Image file bg_body.png Output Sample output
  Accessible without login Image file bg_h3.png Output Sample output
  Accessible without login Image file bg_hint.png Output Sample output
  Accessible without login Image file bg_menu.png Output Sample output
  Accessible without login Image file bg_navbtn.png Output Sample output
  Accessible without login Image file bg_th.png Output Sample output
  Accessible without login Image file bg_tile.png Output Sample output

  Files folder image Files (99)  /  templates  /  summer  
File Role Description
  Accessible without login Plain text file out_html.php Example Sample output
  Accessible without login Plain text file style.css Data Sample output

  Files folder image Files (99)  /  tmp  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data

  Files folder image Files (99)  /  views  
File Role Description
Files folder imageadmin (6 files)
  Accessible without login Plain text file allrequests.php Example Sample output
  Accessible without login Plain text file dump.php Example Sample output
  Accessible without login Plain text file help.php Example Sample output
  Accessible without login Plain text file install.php Example Example script
  Accessible without login Plain text file original.php Example Sample output
  Accessible without login Plain text file performance-check.php Example Sample output
  Accessible without login Plain text file selectserver.php Example Example script
  Accessible without login Plain text file serverinfos.php Example Sample output
  Accessible without login Plain text file update.php Example Sample output

  Files folder image Files (99)  /  views  /  admin  
File Role Description
  Accessible without login Plain text file dump.php Example Example script
  Accessible without login Plain text file lang.php Aux. Auxiliary script
  Accessible without login Plain text file servers.php Example Example script
  Accessible without login Plain text file settings.php Example Example script
  Accessible without login Plain text file update.php Example Example script
  Accessible without login Plain text file vendor.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 65%
Total:224
This week:0
All time:8,230
This week:102Up