Jump to content

How do I optimise proddetail.php in ecommerce shop?


oavs

Recommended Posts

Hi I have been asked to 'optimise ' this file header below. My server keeps blocking all IP's due to over use of this file.  I have no idea why as this file is a part of many other files used in the ecommerce and all other files in the root directory have the same/similar headers. Why only this file?

 

Server tech said this

===================

Your account "stixandstones.com.au" hosted on elessar.nocdirect.com is running various CPU intensive php scripts which are causing very high load on the server and due to which server is going under very high load.

Please have a look at the follow details about your php scripts running in parallel.

 

 Top Process  %CPU 15.0  /usr/bin/php /home/stixands/public_html/proddetail.php

  Top Process  %CPU 14.0  /usr/bin/php /home/stixands/public_html/proddetail.php

  Top Process  %CPU 13.0  /usr/bin/php /home/stixands/public_html/proddetail.php

stixands   605  0.0  0.1  44020 11716 ?        S    15:38   0:00 /usr/bin/php /home/stixands/public_html/proddetail.php
stixands  2094  0.0  0.1  44020 11712 ?        S    15:39   0:00 /usr/bin/php /home/stixands/public_html/proddetail.php
stixands  2685  0.0  0.1  47356 13900 ?        S    15:40   0:00 /usr/bin/php /home/stixands/public_html/proddetail.php

etc etc etc

 

We had no choice but to block web access of your account to stabilize the server because server is currently under very high load.

Please involve a web developer to check and optimize the code to decrease the resource usage. You should optimize your scripts/queries a little further because we believe that there is always some room for improvement.

=================================================

 

Can anyone suggest how to optimise this file?

 

======proddetail.ph===============================

//Author: Vince Reid, vince@virtualred.net

<?php
session_cache_limiter('none');
session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/db_conn_open.php";
include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/includes.php";
include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/languagefile.php";
include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/incfunctions.php";
include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/metainfo.php";
@include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php'; ?>
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/inside.dwt.php" codeOutsideHTMLIsLocked="true" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
<link rel="stylesheet" type="text/css" href="stix.css" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Stix and Stones Baby</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><script language="JavaScript">
 
function popUp(URL) {
 
day = new Date();
 
id = day.getTime();
 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0, locationbar=0, statusbar=0,menubar=0,resizable=0,width=1000,height=600');");
 
}
 
// End -->
 
</script>
 
<!-- InstanceEndEditable -->
</head>
 
<body>
 
<table class="mainTbl" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle">
 
 
<div id="wrapper0">
<div id="wrapper">
 
<div class="mainWrapper">
 
        <div id="slogan"><img src="images/fresh_and_funky.png" width="328" height="18" alt="fresh and funky keepsakes for mum and bub" /></div>
    </div>
 
   
<div class="mainWrapper">
 
<img class="cherry" src="images/cherry_shop.png" width="181" height="235" alt=""  usemap="#cherymap" />
 
<map name="cherymap" id="cherymap">
<area shape= "rect" href= "categories.php"
coords= "63,177,175,233"
alt="stix and stones baby homepage" />
</map>
    
<img class="logo" src="images/logo.png" width="393" height="212" alt="" usemap="#logomap" />
<map name="logomap" id="logomap">
      <area shape= "poly" href= "index.php"
coords= "75,68,131,30,376,79,353,198,105,149,75,114"
alt="stix and stones baby homepage" />
    </map>
 
<div class="box1TopLeft"><div class="box1TopRight"><div class="box1BotLeft"><div class="box1BotRight">
 
    <div class="box1Pad">
 
        <div id="navigation">
            <a href="/index.php">home</a>
            <img src="images/bullet.gif" width="7" height="6" alt="" />
            <a href="/meettheteam/">meet the team</a>
            <img src="images/bullet.gif" width="7" height="6" alt="" />
            <a href="/babyography/">babyography®</a>
            <img src="images/bullet.gif" width="7" height="6" alt="" />
            <a href="/babynames/">names for baby</a>
            <img src="images/bullet.gif" width="7" height="6" alt="" />
            <a href="/contact/">contact us</a>
            <img src="images/bullet.gif" width="7" height="6" alt="" />
            <a href="/stockists/">stockists</a>        </div>
 
 
<div id="leftSide">
<div class="pad1">
 
<?php include("vsadmin/inc/incsidemenu.php") ?>
 
<div class="miniCart">
<?php include("vsadmin/inc/incminicart.php")  ?>
</div>
 
<div class="hr2"> </div>
 
            <div id="babyNameDB" class="box2Top"><div class="box2Left"><div class="box2Right"><div class="box2Bot">
            <div class="box2TopLeft"><div class="box2TopRight"><div class="box2BotLeft"><div class="box2BotRight">
            <div class="pad4" >
            
                <h1 class="pad8">BABY NAME</h1>
                <h1 class="pink">database</h1>
                <div class="go2"><a href="/babynames/babynames.php"><img src="images/go2.gif" width="20" height="20" alt="GO" /></a></div>
            </div>
            </div></div></div></div>
            </div></div></div></div>
            
            <div class="hr2"> </div>
 
            <div id="subscribeBox" class="box2Top"><div class="box2Left"><div class="box2Right"><div class="box2Bot">
            <div class="box2TopLeft"><div class="box2TopRight"><div class="box2BotLeft"><div class="box2BotRight">
            <div class="pad9" >
           
                <a class="subscribeGo" href="/newsletter/"><img src="images/go2.gif" width="20" height="20" alt="GO" /></a>
                <h1>SUBSCRIBE!</h1>
<h1 class="red">to our quarterly newsletter</h1>
                       
            </div>
            </div></div></div></div>
            </div></div></div></div>
        
</div>
</div><!-- end leftSide -->
 
<div id="rightSide2">
            
            <?php include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/nav/incbc.php"; ?>
            
            <!-- InstanceBeginEditable name="mainContent" --><?php include "vsadmin/inc/incproddetail.php" ?><!-- InstanceEndEditable -->                   
           
</div><!-- end rightSide -->
 
 
<div class="clear"> </div>
</div>
</div></div></div></div>
</div><!-- end wrapper -->
 
<div id="footer">
<div class="mainWrapper">
 
            <div id="searchBox">
           <p class="pad3">SEARCH THE SITE</p>
<form id="search" action="/search.php" method="post">
    <input type="hidden" name="posted" value="1" /> 
  <input name="stext" type="text" class="text" />
  <input class="go" type="image" src="images/go1.gif" />
</form>
        </div>
                
            <a class="startShopping" href="categories.php"><img src="images/start_shopping.gif" width="140" height="28" alt="START SHOPPING" /></a>
 
            <p class="copyright">
            ©2007 Stix and Stones Baby. All rights reserved.<br />
Babyography® is a registered trademark of Tracey Donaghey.
                
            </p>
            
            <div class="clear"> </div>
 
            <div class="footerLinks">
<a href="/terms/#care">Customer Care</a> |
                <a href="/terms/#ordering">Ordering & Delivery</a> |
                <a href="/terms/#privacy">Privacy & Security</a> |
                <a href="/terms/#copyright">Copyright</a> |
                <a href="/terms/#terms">Terms & Conditions</a> |
                <a href="/faqs/">Faq's</a> |
                <a href="/links/">Links</a> 
</div>
            
</div>
</div><!-- end footer -->
</div>
</div><!-- end wrapper --></td>
</tr>
</table>
 
</body>
<!-- InstanceEnd --></html>

 

Link to comment
Share on other sites

your first step ought to be to look at your web server access log for the time period in question to see how many and how frequently your site was being requested. if all the requests being made look legitimate (i.e. no hackers probing or exploiting some security hole or a DOS attack) then the issue is likely just normal/expected usage, combined with a cheep low cost web host that doesn't want your site using too much of the spread-too-thin resources on the server.

 

aside from the included .php files, the page isn't doing anything out of the ordinary. you would need to profile all the code on the page to determine which if any of it is using an excessive amount of processing time. perhaps the menus are running queries inside of loops...

 

there's one include statement with an @ error suppressor in front of it. do you know why that is there? trying to include a file that doesn't exist will take some extra time for php to determine that it cannot find and read the file. if the @ is because that file isn't present and you don't need the functionality in it, entirely comment out the statement.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.