Jump to content

Long load Time for PHP Include Statement


zkoneffko

Recommended Posts

I currently have a file that I load on every page of my site with a php include statment: <?php require(DIR_WS_INCLUDES . 'inst/catalog.php'); ?>.  The file loading is rather large and takes a while to download and load.  Is there a way to have the file somehow temporarily saved to the local computer or cached so it does not have to completely reload every time?

Link to comment
Share on other sites

It's definetly the file size.  It's about 700k.  I know it's the file that is slowing it down.  When I remove the file and replace it with a blank file of the same name it load instantly.  That's why I want to find a way to cache the file so it only loads slow the first time and then each time it is called while they are still on the site it would call the cached file and not have to redownload it.

Link to comment
Share on other sites

Web servers are stateless. Each request for a web page is completely separate from all others and all resources used by any web page are destroyed when the script on that page ends. About the only thing you could directly do is use a RAM disk to hold the file so that it would load at memory speed instead of disk speed.

 

However, based on the file name, you should have switched to using a database a long time ago so that you can just query for the relevant information used on any page instead of needing to read in the whole catalog file.

Link to comment
Share on other sites

Heres your problem and it has nothing to do with caching.

 

Your saying your file is 700kb big?

 

If so, optimize that!!!

 

Obiviously files server side will be bigger as they get parsed and show only the input you want.

 

Split the code into different files based on what they do so you don't use memory storing scripts you won't be using.

Remove unneeded HTML code and start using CSS to dress up the HTML instead.

 

The displayed filesize by the phpfreaks forum for this page is roughly 6kb. The SMF boards looks to only include less than 100-200kb of actual PHP files.

Link to comment
Share on other sites

An include statement might somehow be related to this file, but the actual problem is this file is content that is sent to the browser.

 

A Word document is not web friendly. You might have gotten this to do what you want, but as you have found out, it is not an effective way of publishing a catalog on the Internet.

 

No matter what you do with your existing system, you will only be able to make minor improvements.

 

If you provide information on what you actually have and what you are doing on the site, someone can provide direction on the best way of accomplishing it.

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.