Welcome to Dream.In.Code
Become a PHP Expert!

Join 137,427 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,901 people online right now. Registration is fast and FREE... Join Now!




very slow web site

 
Reply to this topicStart new topic

very slow web site

wwonder
7 Jan, 2008 - 12:15 PM
Post #1

New D.I.C Head
*

Joined: 16 Apr, 2007
Posts: 20


My Contributions
the site i am developing has recently started to be very slow to load (and sometimes it is ok) and sometimes it will not even load. the host is fasthost,

two things that i have done since it has become slow is put google anayltics code this is placed at the bottom of the page just before the </body>

i have also attached a link counter the code as follows:

CODE

<?php
include("linkhits.php");  

//function linkcount (){

$query ="SELECT * from links order by sitename";
$result = mysql_query($query) or die(mysql_error());

while ($row=mysql_fetch_array($result))
{
$id = $row["id"];
$sitename = $row["sitename"];
$siteurl = $row["siteurl"];
$hitsout =$row["hitsout"];
}

//echo "<li><a href=\"linkhits.php?id=$id\" target=\"_blank\">$sitename</a></li>";
//}
?>



        <?php
        echo "<li class=\"homead\">
              <h4><a href=\"includes/linkhits.php?id=8\" target=\"_blank\" title=\"Topa\"> <img src=\"adverts/topa.gif\" width=\"100\" height=\"60\" alt=\"Topa logo\" />Topa</a></h4>
              <p>Overseas property specialists.</p>
            <p class=\"more\"><a href=\"includes/linkhits.php?id=8\" target=\"_blank\" title=\"Ca Nicola\">More Info&raquo;</a></p>
            </li>";?>

*edit: Please use code tags in the future. Thanks!


i have created a textonly file without any coding and this also has trouble loading

the site address is

www.boavistaexperience.com

if anyone can help im very new at php and don't know if i have done the code incorrect that is causing the site to become slow.

thanks

This post has been edited by Martyr2: 7 Jan, 2008 - 02:17 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Very Slow Web Site
7 Jan, 2008 - 02:14 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,260



Thanked: 227 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Take out the hit counter and the google analytics for the time being. Also take out any in code linking to third party sites like your weather etc. Then continuously try loading your page. Does it speed up on average? Do you still have the slow performance? If so, then it is something in your code. If it speeds up, it is one of the other hosts your page is contacting which is slow and slows down your page.

Tips for speeding your site...

1) Optimize your graphics and make sure they are proper dimensions (don't take a large graphic and shrink it by adjusting the height/width attributes... just shrink the image to the proper size first). Adjust the colors to make sure they still look good with as few colors as possible.

2) Try to have all code sources, images, and applications hosted on your server. You can't always get this, but the more you can put on your host, the less your page has to contact other servers to get stuff it needs.

3) When coding, always follow good coding practices like preventing too many loop iterations, closing your connections as soon as possible, and try to avoid any operations which would require a lot of reading/writing to a server's hard drive.

4) Write a little code, test, write a little more, test. Keep writing and testing so that when you do hit a slow down, you know that it probably has something to do with the code you JUST wrote.

Hope the tips come in handy.

now I would try to remove any links to 3rd party websites for the time being and see if your own code is solid. If it is, then you can add your other links back one at a time until you notice the site is slow. Then you will have your answer as to what is going on.

"At DIC we be the website performance code ninjas!" decap.gif
User is offlineProfile CardPM
+Quote Post

wwonder
RE: Very Slow Web Site
8 Jan, 2008 - 06:47 AM
Post #3

New D.I.C Head
*

Joined: 16 Apr, 2007
Posts: 20


My Contributions
i will try this its just the site is now quite large and i will have to edit each page, i have a text only page one that i saved as php and one in html the html page loads instantly where as the same file saved as php does not.

could it be that fasthost slow down with dynamic pages??

http://www.boavistaexperience.com/textonly.html

http://www.boavistaexperience.com/textonly.php


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/5/08 04:49AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month