Page 1 of 4 123 ... LastLast
Results 1 to 15 of 52

Thread: For decker ( and anyone else with massive resource usages soley because of one user )

  1. #1
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    For decker ( and anyone else with massive resource usages soley because of one user )

    http://interviolet.com/download/php_...hp_loadavg.zip

    An extension to check loadaverage on execution and halt execution / redirect browser if above a certain level for the last one five or ten minutes ...

    Download to your computer somewhere and open load.c

    Code:
    PHP_INI_BEGIN()
    PHP_INI_ENTRY("loadavg.one", "0.3", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.five", "0.5", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.ten", "0.5", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.redirect", "http://google.com", PHP_INI_ALL, NULL )
    PHP_INI_END()
    PHP_INI_ENTRY( string name, string value, PHP_INI_ALL, NULL )

    edit the above entries to something that your server can cope with ( higher than 1.0, and keep the decimal point ), also change loadavg.redirect to some page on your server like

    "PHP is smashing all the resources, blame Johnson"

    then upload the files to a newly created directory anywhere on your server, and do the following ...

    Code:
    cd /path/to/newly/created/directory
    phpize
    ./configure --enable-loadavg
    make
    make install
    add loadavg.so to your extension loaders in php.ini

    Problem avoided, of course you could create a php.ini just for one user, so long as you're root the user can't change it and ini_set( ) from php will be ignored, the only values used are the ones in load.c .....
    Last edited by Jan; November 24th, 2007 at 13:48. Reason: replaced URL by request
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  2. #2
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Won't configure

    in var/opt so that bits okay?!
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  3. #3
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    show me error ... I built a copy for your version of php in /home/intervio @ loadavg.so
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  4. #4
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ./configure --enable-loadavg
    -bash: ./configure: No such file or directory
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  5. #5
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    copy and paste this code in your terminal

    Code:
    cd /var/opt/phpize && phpize && ./configure --enable-loadavg && make && make install
    phpize is a command, it generates a configure script from config.m4 files, there is no configure right now ....
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  6. #6
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did it

    Changed to values in load.c ;

    PHP_INI_BEGIN()
    PHP_INI_ENTRY("loadavg.one", "1.0", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.five", "1.5", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.ten", "2.5", PHP_INI_ALL, NULL )
    PHP_INI_ENTRY("loadavg.redirect", "http://www.web-spot.co.uk/alert.jpg", PHP_INI_ALL, NULL )
    PHP_INI_END()
    Last edited by Decker; November 15th, 2007 at 09:07.
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  7. #7
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah you still have to add it to /usr/local/lib/php.ini, where all the other extension=whatever.so lines are, just add

    Code:
    extension=loadavg.so
    at the end ... then
    Code:
    httpd restart
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  8. #8
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Already done - I might change the landing page though maybe.
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  9. #9
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its not loaded .... don't see it added in php.ini ....
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  10. #10
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haven't restarted httpd yet

    Don't tell me you were going to test it out ??
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  11. #11
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tested already, just noticing that it's not loaded dispite being installed ... so thought I would say I can't see it in php.ini ( I can't write that file but can read it ) ....
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  12. #12
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try it now
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  13. #13
    stop staring krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now it's loaded I feel much better ....
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  14. #14
    Officially Old! Decker's Avatar
    Join Date
    Dec 2003
    Location
    West Yorkshire, Englandshire
    Posts
    10,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So do I for some strange reason - cough.....

    Nice work Joe
    /\__/\ We Do Not Forgive!
    (- o *) We Do Not Forget!
    (")_(") Expect Us!
    IT Help for everyone @ Scotia-IT.com - when it's finished

  15. #15
    The Hosting Tool JonnyH's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    2,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That could really come into play for people like us, running free hosts. Cheers Joe once again.
    ~ The Hosting Tool ~ cPanel WHM/DA Support! cP Creator Importer! Post 2 Host! Fully Automated! ~ thehostingtool.com

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •