http://interviolet.com/download/php_loadavg/php_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
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 ...
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 .....
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 a moderator: