Category Archives: Scripting

Installing The PHP-MemCache Module On CentOS 5.0

Author & Content by Tim Haselaars (

“MemCached” is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

In this howto I explain how you can very easily install it and make it avaible in PHP.

You need to activate the RPMForge custom repository (formely known as Dag Wieers):

Grab your specific RPM and install it:

rpm –install rpmforge-release-*.rpm

yum install –enablerepo=rpmforge memcached

Now memcached is installed.

You can test it:

memcached -m 512 -u nobody -vv

First, you start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you’ll likely use:

./memcached -d -m 2048 -l -p 11211 -u nobody

This starts memcached up as a daemon, using 2GB of memory, and listening on IP, port 11211. The -m switch specifies the amount of memory in megabytes. The -l switch specifies the IP to listen on and finally the -p switch specifies the port to listen on. The default port is 11211 and if your machine has just 1 IP you can omit the -l parameter. In the above example I set the amount of memory to 2GB. Of course you should use a sensible amount of memory. Making your machine swap to disk sort of defeats the purpose of a memory cache daemon. Note that it’s perfectly fine to run the memcached daemon on another machine than the one you’re running your actual PHP project on. You could even set up a machine totally dedicated to being a memory cache server. And if that’s not even enough you can set up multiple servers as well. The sky is the limit. Note: if you try to start the memcached as root it will require you to specify a user under which it should run with an additional -u nobody.

Installation of the PHP MemCache extension:

cd /files/download/


tar -xvf memcache-2.1.2.tgz

cd memcache-2.1.2

phpize && ./configure –enable-memcache && make

Copy the file to the default module directory.

vi /etc/php.ini


/etc/init.d/httpd restart

If you check your phpinfo() you should see a MemCache section appear.

You can now fully use the MemCache functionality in your PHP.



Five scripts that make life easier with Vim

By: Joe ‘Zonker’ Brockmeier

The Vim editor allows you to modify its behavior via scripts, and the Vim community has produced hundreds of scripts that may help you be more productive, or add functions to Vim that you’ve always wished it would have. Here are five that I find particularly useful.

To install most scripts, copy them to your ~/.vim/plugins directory and restart Vim. Each script should (and usually does) have instructions on installing it, so check the script’s page for additional directions.


Introducing Remo – An Easy Way to Secure an Insecure Online Application

Say you have a nasty application on your Apache webserver that has been installed by some jerks from the marketing department and you can neither patch nor remove it. Maybe it is a problem of ressources, a lack of know-how, a lack of source-code, or possibly even due to political reasons. Consequently, you need to protect it without touching it. There is ModSecurity, but they say this is only for experts. A straightforward alternative is Remo, a graphical rule editor for ModSecurity that comes with a whitelist approach. It has all you need to lock down the application.


Apache: Creating A Session-Aware Loadbalancer Using mod_proxy_balancer

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 05/26/2007

Since Apache 2.1, a new module called mod_proxy_balancer is available which lets you turn a system that has Apache installed into a loadbalancer. This loadbalancer retrieves requested pages from two or more backend webservers and delivers them to the user’s computer. Users get the impression that they deal with just one server (the loadbalancer) when in fact there are multiple systems behind the loadbalancer that process the users’ requests. By using a loadbalancer, you can lower the load average on your webservers. One important feature of mod_proxy_balancer is that it can keep track of sessions which means that a single user always deals with the same backend webserver. Most websites are database-driven nowadays with user logins etc., and you’d get weird results if a user logs in on one backend webserver, and then his next request goes to another backend webserver, meaning he’d get logged out again. You can avoid this by using mod_proxy_balancer’s session-awareness.


Using Ruby On Rails With Apache2 On Debian Etch

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 05/19/2007

This article shows how you can install Ruby on Rails (RoR) and integrate it in Apache2 on a Debian Etch system (including a short section at the end showing how to use RoR in a web site created with ISPConfig). Ruby on Rails is a web application framework which is rapidly gaining popularity among web programmers. It aims to increase the speed and ease with which database-driven web sites can be created and offers skeleton code frameworks (scaffolding) from the outset. Applications using the RoR framework are developed using the Model-View-Controller design pattern.

Read more at 

Real world Rails: Caching in Rails

About this series

Rails has an unmistakable reputation among developers. Rails represents buzz and sizzle; extreme productivity, and controversy. Depending on who you ask, Rails is hyper productive or a toy, well marketed or over hyped. Like many newer technologies, Rails also has a reputation as unproven with limited scalability. Unlike the C and Java™ languages, Ruby is interpreted, with all of the inherent performance handicaps.

In reality, many of the largest sites on the Internet use interpreted languages. They use the same strategies that Ruby uses: clustered, shared-nothing architectures. And they cache. To get the best possible performance, most sites will need an effective caching strategy. Rails developers are beginning to follow suit.

A few scenarios

First, allow me to walk through a few pages of I’ll show you a few places on the site where I’m likely to need a cache. Then, I’ll point out the choice we made for each, and the code, or the strategy, that we use to implement these pages. In particular, I’ll talk about what we do for all of the following:

* Full static pages
* Dynamic full pages that rarely change
* Dynamic page fragments
* Application data

Read more at DevloperWorks

About RoR – Ruby on Rails

There is a lot of talk regarding Ruby on Rails and I am very much interested in learning this. So, in order for me to remember sites that I need to read and re-read regarding Rails, I make list of links that I already visited and will visit in when I have the time. The list of links follows: