954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Site is taking a long long time to load.

Hi,

I have uploaded a web site on the server then I hav tested it on the browser but it is taking a lot of time to load its contents. I dont have anything heavy in the site, does anybody know any solution to overcome this problem??

Please reply.
Take care.
Coolmind

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

sometimes it happens when your mysql query goes in infinite loop.
carefully check all the queries.

navi17
Junior Poster
118 posts since Oct 2007
Reputation Points: 15
Solved Threads: 6
 

Do you have any js-based analytics or advertising etc.? These can really slow down sites - I had to remove some of them from mine.

Is the slow load experienced on every computer or on every browser?

Have you pruned the page to various stages of undress to see which component is causing the delay? As prev. mentioned,loops (especially nested loops) may be the cause of your woes.

Do you have hundreds of people viewing your site at any given time? Is your server up to the task?

You could time certain procedures with microtime(), to give you a list:

$start = microtime(true);

//YOUR PROCEDURE e.g. loop

$end = microtime(true);

$elapsed = $end - $start;

echo "Procedure 1 = {$elapsed} seconds";

//repeat as necessary
diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

What system is the website running on?

You can use the following commands to find this out:

echo "Site Software: ".$_SERVER["SERVER_SOFTWARE"]."";
echo "Proccessors: ".$_SERVER["NUMBER_OF_PROCESSORS"];


If the proccessor returns something silly like 1 then that might be an issue (these things can take allot of proccessing) but this wouldn't be the main issue.

Does your site finish loading or does it take soo long you give up? If this is the case AND the site software is Windows IIS then it could mean you need to configure IIS to accept PHP extensions.

Josh Connerty
Posting Whiz
342 posts since Apr 2009
Reputation Points: 31
Solved Threads: 27
 

Be sure that all images, style .css files and .js files load fast. Add some code to your index.php file to see server-side page generation time. Loading time, data transferring speed and page generation time are different things.

AaliyahRoma
Newbie Poster
2 posts since Apr 2009
Reputation Points: 8
Solved Threads: 0
 

Hi There,

I am using .htaccess file in my site. I have defined .htaccess rules for each file seprately, does this slow slow down the loading speed of the site??

Please reply
Coolmind

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

Have you tried renaming htaccess to something else and then testing the page? I notice you're not in any rush for this!

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Hi Ardav,

Thank you for your help. I have tried renaming .htacess file to htaccess and I think the site is loading quick now. Actually my .htaccess file was hidden on my server.

I have just renamed .htaccess file to htaccess then upload on my server, any suggestion?

Thank you
Take care,
Coolnmind

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

Your .htaccess file may still be there if you've just uploaded another file called htaccess. I was thinking of renaming it to, say, htaccess.txt in situ, i.e. on the server in your FTP view. I don't know enough about htaccess to be able to advise you, but it seems like the obvious culprit if you've got nothing else in your files that could account for the slow loads. Have you contacted your host to ask them for advice? It could be that you're on a shared host with some naughty people who are serving mp3s and videos and slowing everybody down.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

HI Ardav,

I don't think that .htaccess file is slowing down the loading. I have renamed the .htacess but I still see the same result.

I can not figure out what is the problem. Can you check the site for yourself.

http://www.freelanceiq.net/

Take care,
Coolmind

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

I checked your site and when viewing it, the page is almost a Megabite in size. I would suggest using the flush() function immediately after every javascript file is included.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Did you check the optimization site almostbob gave you?
the site

It is really handy, I used it for mine too

Kruptein
Posting Whiz in Training
258 posts since Sep 2009
Reputation Points: 25
Solved Threads: 11
 

Thank you for your help.

why do I have to use flush() in every javascript file. What if I put it at the end of all the files.

Coolmind

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

Yes, I used this site.

coolmind259
Light Poster
34 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

may be everything is taken from database at the instant u open the website make sure tht there is little oad on database while uploading

moin123
Light Poster
27 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Thank you for your help.

why do I have to use flush() in every javascript file. What if I put it at the end of all the files.

Coolmind


Well the flush() function sends the currently processed information to the browser instead of waiting for the entire page to be processed. And these flush() functions need to be in the main php file which the user is viewing from the url. It can be handy for very large pages like yours and although the overall result will take just as long to load, the user can see parts of it at a time as it is being processed if the flush() function is being used.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You