Install APD on CentOS 5

Here is how to install APD (Advanced PHP Debugger) on CentOS 5. Lets start by creating a directory for it to log files to.

cd /tmp
mkdir apd
chown apache:apache apd

We need to remove ioncube, or it will cause errors.

rpm -e php-ioncube-loader

Now we can install APD, via PECL.

pecl install apd

Add the following to php.ini.

[apd]
zend_extension=/usr/lib64/php/modules/apd.so
apd.dumpdir=/tmp/apd
apd.statement_tracing=0

My PHP binary was in a different location, so I had to alter the script too.

cd /usr/bin/
vim pprofp

Change /usr/local/bin to /usr/bin and save the file.

You also need to ensure PEAR is in your include path (/usr/share/pear) for the script to work.

Create permenant aliases with .bashrc

Sometimes, it’s easier to create an alias when working with the Unix command line. Having to create these every time seems to defeat the point of having a short alias though. Luckily, you can make them persistent.

Lets assume that we are using a user called mike. We need to be in our home directory.

cd /home/mike

The .bashrc file should be in there, but hidden.

ls -a

You should be able to see it listed. Now lets edit it.

vim .bashrc

And add a command in, for example, to save our usual CVS update command.

alias upd='cvs -q update -P -d'

Now save and exit. After that, every time you log onto the box you can use the upd command to run the CVS update.

Installing GCC 4.4 on CentOS 5

If you’re running CentOS, you may find yourself frustrated that you have GCC 4.2 or older, when you need to be running at least 4.3 for some features – for example, if you want to compile HipHop for PHP.

Never fear, you don’t need to compile a compiler from source!

As well as the gcc RPMs in the repository, there are also a set for GCC 4.4, appropriately enough named gcc44 and you can install them in the usual way.

yum install gcc44 g++44

ImageMagick, Apache and Debian

Following on from my previous post about installing ImageMagick from source, to get it working with Apache you need to do the following. First, we need to install something from Pecl. So make sure you have the pecl command at hand – if not, install it.

apt-get install pear

Then run the following.

apt-get install php5-dev
pecl install imagick

Finally, add the extension to your php.ini.

extension=imagick.so

Installing PNG support for Debian

Following on from my recent post about adding JPEG support, I also needed to add PNG support. I couldn’t get the RPM’s to work, so I had to do this manually as well.

wget http://downloads.sourceforge.net/project/libpng/00-libpng-stable/1.2.39/libpng-1.2.39.tar.gz?use_mirror=kent
tar -zxvf libpng-1.2.39
cd libpng-1.2.39/scripts
cp makefile.linux ../makefile
cd ../
make
make install