Optimization Tutorials

Install APC on Ubuntu 11.10

In this tutorial, we will look at how to install APC (Alternative PHP Cache) on an Ubuntu system. As we should know, APC is a free and open framework which caches and optimizes the intermediate code generated when interpreting PHP scripts. This improves performance since the PHP scripts don't have to be interpreted every single time they are run. You can think of APC as compiling your PHP scripts into small executable files.

Image to Base64 Conversion Tool

Did you know that images can be embedded right into the HTML code of a page and not require an external resource to work? It is true. Using the Data URI scheme, the binary data from images can be encoded using base64 encoding and embedded right into an HTML page.

PHP Memory Limit and htaccess

The PHP memory limit will need to changed sooner or later as we start writing and running more resource intensive scripts. The idea of a memory limit is important on a web server since the server may be serving many requests at a given time, and we wouldn't want any one request or script consuming too many resources. Also, it is useful to limit how much memory a script can consume in a setting (like a VPS) where resources like RAM are limited.

Change DNS Server in Ubuntu from the Command Line

Changing the existing Domain Name Server IP address or configuring DNS name resolution under Ubuntu Linux is fairly simple with the command line. All you need to do is edit the /etc/resolv.conf file. You may want to change your nameserver for a number of reasons. Suppose your existing nameserver is slow or is not updating properly; you can specify a new nameserver to get rid of all those problems.

Simply use your favourite text editor to edit the file /etc/resolv.conf as the superuser.

To use nano text editor:

Using wget and an XML Sitemap to Spider website - Keeping the Drupal cache warm

This tutorial will speak in the context of using this technique on a website which uses Drupal for content management. This technique need not be limited to a Drupal website and should work well if adapted properly.

Enable Compression on Apache with mod_deflate

Enabling compression on Apache is a trade-off between CPU load and bandwidth. It is usually faster to compress content as more time is saved when transferring a smaller file as opposed to the minimum CPU time which is required to compress the data in the first place. We first need to enable mod_deflate. This is the module which handles the compression of the data.

On modern Linux versions with Apache 2:

a2enmod deflate

On Windows edit the "httpd.conf" file and uncomment the following line like so: