Using PHP caching in IPB

Discussion in 'IP.Board Discussions' started by Mike, Nov 26, 2009.

  1. Mike

    Mike Adept

    Joined:
    May 23, 2009
    Messages:
    137
    Likes Received:
    88
    Location:
    Lafayette, IN, USA
    First Name:
    Mike
    By default, IPB will store all cached data in the database. But if you would like to take advantage of a PHP accelerator or content cache, there is support for APC, eAccelerator, Memcache and XCache, as well as for storing data in files.

    Admins of larger sites will likely want to take advantage of using an external cache source, but even smaller forums will certainly benefit. I've seen performance improvements on all of my sites as a result of this simple change.

    Your first step will be to make sure you have one of the PHP cache systems installed on your server. If you make the selection to use a cache sytem and the extension is not available, IPB will simply revert to the default cache store method.

    Once you are sure you have the cache system installed, you will need to add a line to your conf_global.php file, to enable the system.

    For APC:

    Code:
    $INFO['use_apc'] = '1';
    For eAccelerator:

    Code:
    $INFO['use_eaccelerator'] = '1';
    For Memcache:

    Code:
    $INFO['use_memcache'] = '1';
    For XCache:

    Code:
    $INFO['use_xcache'] = '1';
    For disk storage:

    Code:
    $INFO['use_diskcache'] = '1';
    Once you have saved the edited conf_global.php file to your server, IPB will begin using the chosen cache method.

    If you have more than one IPB forum installed on your server, you may need to use an identifier with the cache method you have selected. You will need to edit the ips_kernal/classCache/*.php (the file you edit will depend on the cache storage you are using) file.

    Find this line -

    Code:
    private $identifier    = '';
    Add whatever value you prefer, such as:

    Code:
    private $identifier    = 'forum1';
    I hope you will find some performance improvement by using this tip.
     
    8 people like this.
  2. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
    Wow Mike! Great stuff!

    Other than us going to our hosting provider and asking, is there a way to check what sort of accelerator program they have installed?
     
  3. Mike

    Mike Adept

    Joined:
    May 23, 2009
    Messages:
    137
    Likes Received:
    88
    Location:
    Lafayette, IN, USA
    First Name:
    Mike
    It just came to me that some of you may not know how to verify the installation of a PHP cache system on your server. It is actually quite simple.

    Method number one is to log into your IPB 3.0 Admin CP and select the Support tab. Under Syatem Overview, you will see PHP Version information, followed by (PHP INFO). Click on that last bit and your server's PHP information will be displayed for you.

    Method number two (in case you are not yet running IPB) will require you to write a very short PHP file, to store in your server's root. Copy the following into a simple text editor -

    Code:
    <?php 
    
    phpinfo (); 
    
    ?>
    Now save the file as phpinfo.php and then you will be able to FTP the file to your server's root directory.

    Now you will be able to point your browser to yourdomain.com/phpinfo.php and you will be able to see the same information.

    WARNING: Once you have retrieved the information you wanted, delete phpinfo.php from your server, to prevent any security risks. You have been forewarned.

    I have attached a snippet from one of my own sites in the attached image and you will see I am utilizing eAccelerator.

    Once again, I hope this information will help someone. I may need to pick your brain some day. ;)
     
    4 people like this.
  4. Mike

    Mike Adept

    Joined:
    May 23, 2009
    Messages:
    137
    Likes Received:
    88
    Location:
    Lafayette, IN, USA
    First Name:
    Mike
    I was posting the solution as you posted the question. ;)
     
  5. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
    Thanks Mike! I added the line based on the accelerator that I have setup for my server :)

    Every little bit of help, helps! :D
     
  6. MattMecham

    MattMecham Novice

    Joined:
    Aug 26, 2009
    Messages:
    36
    Likes Received:
    41
    2 people like this.
  7. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,444
    Likes Received:
    219
    Great info, Mike - thread stuck. :D I'm going to have to create an "IPB" section in the Articles area soon if you keep going at this rate. :lol: Please do continue to share your wealth of knowledge.
     
  8. Mike

    Mike Adept

    Joined:
    May 23, 2009
    Messages:
    137
    Likes Received:
    88
    Location:
    Lafayette, IN, USA
    First Name:
    Mike
    Nick, I'm just trying to share what I have been finding on my own. I just hope others will be able to benefit from the odd bits I have posted.
     
  9. BamaStangGuy

    BamaStangGuy Administrator

    Joined:
    Jun 23, 2009
    Messages:
    769
    Likes Received:
    549
    Location:
    Huntsville, AL
    I always wondered if IP.Board supported this out of the box. Good to know. About to convert another vBulletin site of mine.
     
  10. Brandon

    Brandon Regular Member

    Joined:
    Jun 1, 2009
    Messages:
    6,602
    Likes Received:
    1,706
    Location:
    Topeka, Kansas
    First Name:
    Brandon
    Great info Mike, IPB will need to start paying you before to long :D
     
  11. BamaStangGuy

    BamaStangGuy Administrator

    Joined:
    Jun 23, 2009
    Messages:
    769
    Likes Received:
    549
    Location:
    Huntsville, AL
    I am finding this to be a hassle. When you alter any of the settings you have to force IP.Board to recache all the settings. It doesn't update xCache right away meaning that results on the forum are not showing your new settings.

    Anyway around this?
     
  12. AWS

    AWS Administrator

    Joined:
    Feb 1, 2010
    Messages:
    1,616
    Likes Received:
    692
    Location:
    Joliet, IL U.S.A.
    First Name:
    Bob
    Make sure you have the option in server settings set to send no-cache headers. You really shouldn't turn on caching until you have everything setup and running. I found this out early when I was setting up my conversion. I would upload a new style and then when I'd go to upload the images the style I wanted to use the images with wouldn't be in the list. New3 plugins wwouldn't show up either and when I disabled a plugin it would still show in the enabled list. I would have to hard refresh of the browser to force a new page load to see my changes.

    What I do now is leave it off until all plugins and styles are done. The I turn it on.
     
  13. Mike

    Mike Adept

    Joined:
    May 23, 2009
    Messages:
    137
    Likes Received:
    88
    Location:
    Lafayette, IN, USA
    First Name:
    Mike
    I use eAccelerator, but I used the same technique. Get things the way you want and then turn on the caching.
     

Share This Page