If I want my pages to load faster, should I use some form of caching? How can I ensure that new images and content will be loaded though?

Another side question:

Say my page were laid out with frames,
one on top for my site logo and a google add next to it and all the links for my site
and one frame under it for content.

Would the google add change for each page (even though the part of the page with the google add isn't being changed) and would I still get the impression count for every page load?

    hi

    I cache my pages

    I use maybe the best FREE php accelerator there is:

    http://eaccelerator.net/HomeUk

    I am using an easy package install:

    Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.

    XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.

    At the moment there are four XAMPP distributions:
    - XAMPP for Linux
    The distribution for Linux systems (tested for SuSE, RedHat, Mandrake and Debian) contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.

    • XAMPP for Windows
      The distribution for Windows 98, NT, 2000 and XP. This version contains: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.

    • XAMPP for Mac OS X

    • XAMPP for Solaris
      ================================================

    As XAMPP ( LAMPP ) Installs by default with eAccelerator ENABLED

    I needed not do anything myself.
    With AUTO Install I got it all in less than 30 minutes!!!!

    http://www.apachefriends.org/en/xampp.html

    This are versions you get in latest Linux XAMPP Package
    XAMPP for Linux 1.4.15, August 15th 2005

    XAMPP Linux 1.4.15, 39 MB :


    Apache 2.0.54,
    MySQL 4.1.13,
    PHP 5.0.4 & 4.4.0 ( Both latest versions of php5 and php4 )
    PEAR + SQLite 2.8.9/2.8.14 + multibyte (mbstring) support,
    Perl 5.8.7,
    ProFTPD 1.2.10,
    phpMyAdmin 2.6.3-pl1,
    OpenSSL 0.9.8,
    GD 2.0.1,
    Freetype2 2.1.7, libjpeg 6b, libpng 1.2.7, gdbm 1.8.0, zlib 1.2.3, expat 1.2,
    Sablotron 1.0, libxml 2.4.26, Ming 0.2a, Webalizer 2.01, pdf class 009e, ncurses 5.8, mod_perl 2.0.1,
    FreeTDS 0.63, gettext 0.11.5, IMAP C-Client 2004e, OpenLDAP (client) 2.2.13, mcrypt 2.5.7, mhash 0.8.18,
    eAccelerator 0.9.3, cURL 7.13.1, libxslt 1.1.8,
    phpSQLiteAdmin 0.2, libapreq 2.04-dev

    And most everything above is compiled with and enabled by default

    😉

    /halojoy using
    lightning fast webserver
    lighttpd DEMO setup at
    http://213.100.118.115:8888/

    😉

      as
      you
      see

      also is included a nice
      website stats application

      Webalizer http://www.mrunix.net/webalizer/

      Here are my website stats for August 2005:

      http://213.100.118.115/phpextra/usage_200508.html

      [right]==============================
      Hits by Response Code
      ------------------------------------------
      Code 200 - OK 1649
      Code 206 - Partial Content 2
      Code 301 - Moved Permanently 4
      Code 302 - Found 67
      Code 304 - Not Modified 166
      Code 400 - Bad Request 2
      Code 403 - Forbidden 1165
      Code 404 - Not Found 104
      ==============================[/right]
      🙂 🙂

        Thanks for that meaty reply 🙂

        My pages are full of PHP and mysql content that is constantly changing. I guess I would have to be able to make all that stuff is updated every page view. The only thing I really want to cach are the images on the site.

        Is there an easy way to do this?

        If not, I'll look into XAMPP.

          sure there is a way

          but has more to do with your web server
          than with php

          php can be set to cache .php pages in various techniques
          but
          images and other sort of pages: HTML CSS ...
          is controlled mainly by web HTTP server

          of course
          we can write custom php scripts
          that cache images
          in a sepcial part, folder directory of your website

          but mainly, besides .php is is apache doing caching

          and also web browser can be set to cache images
          on the client side
          when images dont even are served, transfered to visitor
          but an image from web browser cache folder in your PC interenet files / pages
          are used instead

          /halojoy

            Are you generating images on the fly, or watermarking them or something?

            I use Smarty for caching and my own routines to cache mysql complex joins. When changes are made to the database a 'thrash your cache' message is sent out to all sites that use the data. Two copies are made for each page - one with the user logged in, one logged out, each showing appropriate content. All of those pages show generic content, as personal detail is only needed in certain uncached areas. You'd be surprised at what you can get away with. If you can deliver a page without making a database connection then do it, check if it's cached first THEN connect if you have to, you'd be staggered by how much time that saves.

              If your pages are cachable you do not need php. If they are dynamic though all you can save on is bandwidth not CPU cycles as you will need to build the page to know it has not changed since they first downloaded it.

              Regarding images, what you need to do is everytime somebody requests an image cache the image you made in a local directory. Now when someone requests an image before starting over making a new one check first if there is a cached copy. Check the filedate of the cached copy against the date in If-Modified-Since. If 'If-Modified-Since' is empty or the date is different you need to make a dissission on making a new image or serving the one in the cache. If the filedate and If-Modified-Since are the same send a 304.

                bokehman wrote:

                If your pages are cachable you do not need php. If they are dynamic though all you can save on is bandwidth not CPU cycles as you will need to build the page to know it has not changed since they first downloaded it.

                That is very, very completely wrong. Often times pages require PHP for database interaction but don't change on every single request, so you can cache the page and only refresh it once every hour, once every xxx number of requests, when a database query returns a different count, etc. None of these neccessarily involves building the entire page. In addition, often times you can cache individual chunks of a page as the entire page might not change on every request.

                Either way you'll save a signifigant number of CPU cycles.

                If you don't believe me, go ask the poeple at Wikipedia if caching is useless... they run one of the most dynamic, PHP based websites on the internet and about 80% of all hits are static caches:
                Wikipedia Caching Strategy

                  Write a Reply...