Author |
Message |
andrej
Hangin' Around

Joined: Sep 10, 2005
Posts: 48
|
Posted:
Mon Jun 18, 2007 2:46 pm |
|
Hello !
I have a raven scripts based phpnuke webpage( version released in december 2005, don't know which number is it really) but with a couple additional modules.
My webhost said modules.php consumes a huge amount of CPU power.
What should i do ?
This is the script.
Code:define('MODULE_FILE', true);
require_once('mainfile.php');
$module = 1;
$name = trim($name);
if(!isset($file)) { $file='index'; }
if(isset($name)) {
if(eregi('http\:\/\/', $name)) { die('Hi and Bye'); }
if(eregi('http\:\/\/', $file)) { die('Hi and Bye'); }
$modstring = strtolower($_SERVER['QUERY_STRING']);
if(stripos_clone($modstring,'&user=') AND ($name=='Private_Messages' || $name=='Forums' || $name=='Members_List')) header('Location: index.php');
global $nukeuser, $db, $prefix;
$nukeuser = base64_decode($user);
$nukeuser = addslashes($nukeuser);
$result = $db->sql_query('SELECT * FROM `'.$prefix.'_modules` WHERE `title`=\''.$name.'\'');
$row = $db->sql_fetchrow($result);
$mod_active = intval($row['active']);
$view = intval($row['view']);
$groups = $row['groups'];
if(($mod_active == 1) OR (isset($admin) AND is_admin($admin))) {
if(!isset($mop)) { $mop='modload'; }
if(!isset($file)) { $file='index'; }
if(ereg('\.\.',$name) || ereg('\.\.',$file) || ereg('\.\.',$mop)) {
$pagetitle = '- '._SOCOOL;
include_once('header.php');
OpenTable();
echo '<center><b>'._SOCOOL.'</b></center><br />';
echo '<center>'._GOBACK.'</center>';
CloseTable();
include_once('footer.php');
die();
} else {
$ThemeSel = get_theme();
if(file_exists('themes/'.$ThemeSel.'/modules/'.$name.'/'.$file.'.php')) {
$modpath = 'themes/'.$ThemeSel.'/';
} else {
$modpath = '';
}
$modpath .= 'modules/'.$name.'/'.$file.'.php';
if(file_exists($modpath)) {
if($view == 0) {
include_once($modpath);
} elseif($view == 1 AND ((isset($user) AND (is_user($user) OR is_group($user, $name))) OR (isset($admin) AND is_admin($admin)))) {
include_once($modpath);
} elseif($view == 2 AND isset($admin) AND is_admin($admin)) {
include_once($modpath);
} elseif($view == 3 AND paid()) {
include_once($modpath);
} elseif($view > 3 AND in_groups($groups)) {
include_once($modpath);
} else {
$pagetitle = '- '._RESTRICTEDAREA;
include_once('header.php');
OpenTable();
echo '<center><b>'._RESTRICTEDAREA.'</b></center><br />';
echo '<center>'._GOBACK.'</center>';
CloseTable();
include_once('footer.php');
die();
}
} else {
$pagetitle = '- '._FILENOTFOUND;
include_once('header.php');
OpenTable();
echo '<center><b>'._FILENOTFOUND.'</b></center><br />';
echo '<center>'._GOBACK.'</center>';
CloseTable();
include_once('footer.php');
die ();
}
}
} else {
$pagetitle = '- '._MODULENOTACTIVE;
include_once('header.php');
OpenTable();
echo '<center>'._MODULENOTACTIVE.'</center><br />';
echo '<center>'._GOBACK.'</center>';
CloseTable();
include_once('footer.php');
die ();
}
} else {
$pagetitle = '- '._MODULENOTFOUND;
include_once('header.php');
OpenTable();
echo '<center>'._MODULENOTFOUND.'</center><br />';
echo '<center>'._GOBACK.'</center>';
CloseTable();
include_once('footer.php');
die ();
}
if(!function_exists('stripos_clone')) {
function stripos_clone($haystack, $needle, $offset=0) {
return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}
}
?>
|
I haven't changed the original in any way... |
|
|
|
 |
jakec
Site Admin

Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Mon Jun 18, 2007 3:39 pm |
|
What additional modules are you using? |
|
|
|
 |
gregexp
The Mouse Is Extension Of Arm

Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Mon Jun 18, 2007 4:22 pm |
|
Forgive me if I sound a bit overly agressive.
There is absolutley no way modules.php could be using that much resources IMO.
This actually aggravates me to my wits end. I cant imagine any scenario that modules.php would be using that much cpu resources, believe me, there are a select few files, I can think of off the top of my head that MIGHT do it, none of which are modules.php.
Ask your host to be more specific, if they can. Get detail, like how many people are connected when this CPU usage goes up, if the Host doesnt mind, as for a copy of the output of the top command(ssh). Then try to figure out what nuke was doing. I wont say its not possible, but its so unlikely that IMO it doesnt hold water.
Another thing you should do is ask your host how they would like you to resolve this issue, if they ask for more money, I would seriously consider the validity of the claim. I hope this helps. |
_________________ For those who stand shall NEVER fall and those who fall shall RISE once more!! |
|
 |
 |
Gremmie
Former Moderator in Good Standing

Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Mon Jun 18, 2007 4:53 pm |
|
Well just be aware that just about EVERYTHING goes through modules.php in Nuke. So if you have the super duper resource hog module, modules.php may still be blamed since it includes the super duper resource hog.
What other custom modules do you have?
My host once disabled access to modules.php server wide because another customer had installed a hackable Amazon block on their Nuke site, and guess what, it got hacked. So the host disabled modules.php server wide. I had to explain to them it was the other guys block, not modules.php. Only a couple of things worked on my site during this lockdown. The admin functions did, and so did the ourscript.net shoutbox. That is how I communicated with my users that the site was temporarily out of business. LOL. |
_________________ Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module |
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Mon Jun 18, 2007 8:53 pm |
|
Sounds like you're on a crummy shared server. The host cannot take the usage of phpNuke because it is a very database-intensive script. There are some optimizations you can take, but ultimately your host is just going to complain that your site uses too many resources. Time to get a new host |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
 |
jakec

|
Posted:
Tue Jun 19, 2007 12:17 am |
|
Gremmie, is thinking along the same lines as me, but explained himself a lot better.
Definitely go back to your host and try and get more information as Gregexp suggested.
It may also be worth making sure you are upgraded to the latest version of RN and Sentinel. |
|
|
|
 |
andrej

|
Posted:
Tue Jun 19, 2007 12:54 am |
|
I asked the host how many instances of modules.php were running, and they replied only 2 instances were running.
The funny thing is this excessive CPU usage is by no means regular but has occured several times about every two months or so.
Custom modules i currently have are :
Gallery 2.1
Conteudo
Nuke Instant Messenger |
|
|
|
 |
Gremmie

|
Posted:
Tue Jun 19, 2007 7:15 am |
|
I've never used Nuke Instant Messenger, but chat programs in general are known for resource problems if not coded carefully. Try disabling that for a day or two and see if they stop complaining.
Or get a better host. |
|
|
|
 |
|