Installing PHP 5.3.3 from packages on Debian Lenny with apc, xdebug, memcache etc

Building apache and PHP with all its extensions may be fun once or twice but it is a major pain in the neck. So to avoid that (and to have it before Debian Squeeze is released) you can use e special dotdeb repository of almost everything that you may need as a web dev. It is especially convenient if you have a few development servers to update with different configurations and you don't want to waste too much time on it.

You can add the following sources to the Debian Lenny apt sources list:

#file: /etc/apt/sources.list

deb http://ftp.ie.debian.org/debian/ lenny main
deb-src http://ftp.ie.debian.org/debian/ lenny main

deb http://security.debian.org/ lenny/updates main contrib
deb-src http://security.debian.org/ lenny/updates main contrib

deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all

This will allow your system to install new versions of php apache and mysql even that they are not in the stable release yet.

Once you have that you can get the new packages lists:

apt-get update

Then you can install new version of packages with the following command:

apt-get install php5-common php5-tidy php5-sqlite php5-pgsql php5-mysql php-pear php5-dev apache2 apache2-mpm-prefork apache2-utils memcached

Fortunately developers of the repository provide latest versions of many extensions so we can install almost everything we need like so:

apt-get install php5-apc php5-geoip php5-http php5-memcache php5-xdebug php5-mcrypt php5-gd php5-curl php5-imagick

Now, IMPORTANT, make sure you have database backups and database is down before you start the updrage. Databases can sometimes cause problems (happened to me once in postgres) so be careful and make sure you have backup and time :) The following should work ok though:

apt-get install mysql-common mysql-server mysql-client

Now we want to load xdebug as zend engine extension not regular extension. To do that check where are your extensions by running:

php -i |grep 'extension_dir ='

Then edit config ini file to load it properly:

; file: /etc/php5/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so

Then running php -i from command line should not show: XDEBUG NOT LOADED AS ZEND EXTENSION, but rather:

xdebug

xdebug support => enabled
Version => 2.1.0

Supported protocols => Revision
DBGp - Common DeBuGger Protocol => $Revision: 1.145 $

Directive => Local Value => Master Value
.....

If it all goes well it means you are ready to work. To make sure run php -i with output redirected to dev null to see warnings only and list modules list

php -i > /dev/null
php -m

Comments

Fair point, you have to be

Fair point, you have to be careful as tutorials became outdated quickly : )

cheers

art

2011-03-08 15:00
admin

Hi, a friend of mine was just

Hi,
a friend of mine was just following your instruction and ran into serious troubles.
Please highlight that meanwhile lenny was declared as 'oldstable' so it would be better if the 'lenny' sources were referenced instead of the 'stable' ones.

just to let you know.
Lapis

2011-03-05 14:42

Post new comment

Image CAPTCHA

About the author

Artur Ejsmont

Hi, my name is Artur Ejsmont,
welcome to my blog. I am a passionate software engineer living in Sydney and working for Yahoo!

Web Scalability for Startup Engineers

If you are into technology, you can order my book Web Scalability for Startup Engineers on Amazon. I would love to hear what are your thoughts so please feel free to drop me a line or leave a comment.

Follow my RSS