Archive for April, 2007

How to install APC and php4-memcache extension on Debian Sarge

Saturday, April 28th, 2007

To improve the PHP performance, I started playing with APC (Alternative PHP Cache) and memcached recently. However, to install the APC extension and PHP-Memcache client on Debian Sarge turned out to be not that trivial. Here I’d like to share my experience. It serves as my own personal record as well.
First of all, you need to have PHP4-dev and Pear package installed on your system:

apt-get install php4-pear php4-dev

In order to use the ‘pecl’ installation tool, you need to upgrade the bundled PEAR version to the latest:

pear upgrade pear-1.3.3
pear upgrade Archive_Tar
pear upgrade Structures_Graph
pear upgrade pear
pear upgrade-all

After the upgrade, you need one more step before proceeding with the pecl installation. If you don’t do the following you will have the error like this when compiling php-memcache: (configure: error: Cannot find php_session.h). Thanks to this post, I found the solution: you need to create the following symoblic link:

ln -s /usr/include/php4 /usr/include/php

Okay, final step is easy:

pecl install apc memcache

For APC, you may just choose not to compile with aspx-support, if it prompted you to select.

Now sit back, and wait for the compilation to finish. After it is done, you just need to enable the modules in your PHP.ini configuration file, which I am not going to touch upon here.

Good luck with your optimization for PHP code.

Set up a perfect rPath Linux development platform for making your own custom-flavor Linux

Sunday, April 22nd, 2007

The combination of rPath Builder and VMWare Player is a perfect tool for quick web development and distribution, and a quick way to play with Linux right on your desktop.

When trying to build the Ultimate WordPress MU (MultiUser) Appliance, I started to learn rBuilder Online, which I found is not as newbie-friendly as it should be. Thus I wrote this post to record my learning and hopefully it will be shorten your learning time.

The purpose of this tutorial is to get you started in setting up a rBuilder Online project. and use a local rPath Virtual Machine to checkout, test, build and commit your own packages to rBuilder Online. In the end, you will be able to create a virtual machine disk image online, containing your customized Linux.

If you just want to use pre-built packages and organize them into a customized Linux, you can simply use the web interface in rBuilder Online. But if you need to build your own package, please follow the guide here.

To start, you will need at least VMWare Player or VMWare Server (Fusion if you are using Intel Macs) installed on your machine. Make sure you have at least 512MB of physical memory, because the Linux Virtual Machine needs some of your physical memory.Once you have set up your Virtualization environment, download the rPath Linux VMWare Player image. Go to the rPath Linux project website, find a release (currently 1.0.5) and download the VMWare Player image.

While you are downloading the file, get yourself a free account on rPath Builder Online and create a new project. However, please note that the projects hosted on rBuilder Online would be open-source, which means if you want to keep your code secret, you will need to set up your own rBuilder environment. I don’t know how to do yet, but be sure to check out the wiki, though.

All ready! I guess you already got the downloaded zip file for rPath Linux. Unzip it to a folder and use VMWare Player/Server to open the .vmx file. Boot up the Virtual Machine. You will be soon welcomed by a graphical interface from rPath Linux.

Use username: root and empty password to log in.

Open up a text terminal (upper-left corner: Application -> System Tools -> Terminal)

type in the following commands to update the software and install the rmake building tool:

conary updateall
conary update rmake --resolve
service rmake on

Now, the system is almost ready for building packages. But we need to make some new packages. I am not going to the details here because you can follow the easy tutorial in the wiki. Note, you cannot cook new packages using root user, so you will need to create yourself a new user in the system.

After finding the right recipe for your application and cooking it for a test, you are about ready to build it into a trove.

Take a quick look at the workflow for rMake. For a simple package, you can just do this:

rmake build wpmu.recipe

Finally, commit your build into the rBuilder Online repository. Replace the number 1 with any job number you see when you use rmake to build your recipe.

rmake commit 1

Now, you can simply go to rBuilder Online and use the web interface to add your package to a group and cook it.

After cooking the group, you can make a build based on it, and download the disk image with your own customizations! Have fun!