07
Jan
2009



Bookmark and Share

xcache

A few days ago I spoke about how to improve your blog’s performance just by applying some nice, simple tricks which prevent your server from being extensively used, sparing  you from slow queries and CPU quota exceeded errors . Today I still want to speak about ways to make your blog faster and less “resource drainer”, but I want to take the whole matter to a more serious level by writing a tutorial which will let you install a  performing, open-source program called XCache on the server your blog is hosted.

XCache is a cacher application which significantly improves the performance of PHP on servers. The way it works is rather simple. It removes the compilation time of PHP scripts by caching the compiled state of PHP scripts into the RAM,  using the compiled version straight from the RAM itself. As a result your blog will be faster, snappier and your web hosting provider will love you like never before. In fact XCache will reduce the rate of page generation time by up to 5 times,  decreasing thereforeg the serverload. But how to install it on your sever? Here is a simple but effective guide. (Please take into consideration that this guide was compiled on the base of my personal experience and with BlueHost as web hosting provider)

1) First of all, make sure that your web hosting provider isn’t already using it. Contact the support center and ask if they are  using XCache or other accelerators such eAccelerator. If you are shy and want to find by yourself if the server your blog is hosted is using XCache, just copy-and-paste this code to a notepad file, rename it phpinfo.php and place it in the /public_html folder of your server (the folder where your blog is hosted) by using your favored FTP client software:

<? phpinfo(); ?>

Now go to your browser and type: www.yourblog-com/phpinfo.php. At this point a page full of info regarding the PHP environment on your server should appear. Look for Xcache or other application caching your blog.

2) Supposing that your server is not running XCache the first thing to do is to enable zlib.output_compression and PHP5 (FastCGI). Please read this guide to know how to do it.

3) Let’s install XCache. Using a proper, free SSH software (such as Putty…what are you doing? Go download it right away!), login your website and write the following commands:

1. cd ~
2. mkdir modules xcache
3. cd xcache
4. wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
5. tar –zxf xcache-1.2.2.tar.gz
6. cd xcache-1.2.2
7. phpize
8. ./configure –enable-xcache
9. make
10. cd modules
11. mv xcache.so /home/*BLUEHOST-USERNAME*/modules

Steps from 1 to 6 create the folders modules and xcache in the root of your server and download and extract XCache1.2.2  in the xcache folder. Steps 7 to 9 compile the XCache. Steps 10 to 11 move the compiled module (xcache.so) to a  accessible directory (modules) which we will define in our php.ini.

4) Now edit your php.ini file located in your public_html directory by using your notepad. Locate “Windows Extensions”. Right above it, copy-and-paste the following code:

extension = xcache.so
xcache.shm_scheme = “mmap
xcache.size = 32M
xcache.count = 8
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 16M
xcache.var_count = 1
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.test = Off
xcache.readonly_protection = Off
xcache.mmap_path = “/dev/zero”
xcache.coredump_directory = “”
xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off
xcache.coverager = Off
xcache.coveragedump_directory = “”

5) Still in the php.ini file, locate extension_dir. It should be something like this:  extension_dir = /usr/local/lib/php/extensions/no-debug-zts-20060613. Change this row to: extension_dir = “/home/(CPANEL_USER_NAME)/modules”.

6) Still in the php.ini file, go to the end of the file and remove any  additional extensions pointing to the path /usr/local/lib/php/… This because such a path doesn’t exist anymore.

7) Log in your CPanel. Locate  “Process Manager” under the “Advanced” header and kill every process having to do with /ramdisk/bin/fcgiphp5. Keep in mind that the server, after a while will restart, the processes.

8 ) Navigate to your website for a while and enjoy its new performing, astounding speed!

9) To verify that your XCache has been loaded in your server and it is running properly, visualize the famous phpinfo.php in your browser

10) To verify that your server is serving compressed pages  of your website, visit this page and test your blog!

I want to point out that this guide comes from  a medical student, Rishi Kumar who is the excellent webmaster of RK-MD website. RK-MD is a personal blog  whose topics range from politics, medical sci/tech, tutorials and much more. Over there you can find interesting in-sights about PHP coding, WordPress tips, tricks and reviews about computers, Internet and much more! His best tutorials (as far as my opinion is concerned) are the ones which teach you in a simple and clear language how to install XCache and eAccelerator on your server.  A special thank you, my friend Rishi Kumar because you  saved my blog (and me too indeed) from being shut down!




Related Articles Latest Articles
.

6 Comments to “How to make your blog faster with XCache”

  1. Trackback - Cheap Internation Call >> How to make cheap international call Says:

    ,..] http://www.webtlk.com is one another great source of tips on this issue,..]

  2. Web Talk Says:

    well, i have to admit that i dont for sure. They both cache your blog. In my case I had to use XCache because WordPress plugins created me issues. XCache is quite easy to install and really improve your blog speed. Plus there are no compatibility issues with other plugin because it is not a plugin!

  3. waqas Says:

    Is wp-supercache plugin the same as xCache?

  4. clark Says:

    It worked for me, it made my blog a lot faster

  5. Web Talk Says:

    Hi Rishi,
    you don’t know how useful you have been to me! I really have to thank you. If you need EVERYTHING you know where to get me! 😉

  6. Rishi Says:

    You are very welcome, my friend. Thanks for the kind words! Glad you enjoyed the article. 🙂


Copyright © 2007-2017 | Sitemap | Privacy | Back To Top
Best screen resolution 1280x800 or higher.
Web Talk is best viewed in Firefox.

Stat