Jump to content

PHP Pages Loading Slow...What to do?


mattpooch

Recommended Posts

I've got this page http://www.skipwallace.com/2010site/home.php and all the page extensions are .php to accommodate the random affiliate ads on the page.

 

What can I do to make these pages load faster?  Would it help if they were HTML?

 

Oh, when I create 'index.php' would that work the same as 'index.html' or do I need a redirect? 

Link to comment
https://forums.phpfreaks.com/topic/189310-php-pages-loading-slowwhat-to-do/
Share on other sites

  Quote
What can I do to make these pages load faster?  Would it help if they were HTML?

If the ads are served from a 3rd party server then they will have to be requested on each page load. Pages serving lots of ads will generally be slow. I don't know why your would request ads using php. They are usually javascript. If so you can include the ad code to be loaded after the HTML is sent to the browser. The server where the ads are requested from maybe busy therefore slowing your page load also.

 

Other things that can slow down a page are heavy database queries or poor code.

no. i do not understand. affiliate ad code is fixed into your template. if you wanted to randomise between different ads then simply store the javascript code in different include files. i.e

ad1.js

ad2.js

ad3.js

To make it pick a random ad:

<script language="javascript" src="ad<?php print rand(1,3); ?>.js"></script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.