Skip to main content

Install PHP 5.3.0/Lighttpd On Debian (Lenny) With Imap, MySQL, Sqlite3 And ImageMagick Support

Install PHP 5.3.0/Lighttpd On Debian (Lenny) With Imap, MySQL, Sqlite3 And ImageMagick Support


This tutorial covers the setup of PHP 5.3.0/Lighttpd on Debian (lenny) with imap, mysql, mysqli, sqlite3, ImageMagick and mycrypt support.

For this tutorial I will assume you are logged in as root this is not advised.

First we need to install the webserver:

aptitude install lighttpd

Now we install the packages needed for mysql and mysqli support. You will be promoted to enter a mysql root password - please use a strong password.

aptitude install mysql-server mysql-client libmysqlclient15-dev

Next install some packages php needs to compile.

aptitude install libtidy-dev curl libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6 libfreetype6-dev libbz2-dev libxpm-dev libmcrypt-dev libmcrypt4 sqlite3 bzip2 build-essential libreadline5-dev libedit-dev

Install packages required for imap support. You will be promoted to enter a domain for Kerberos - normal practice is to set this as the domain name of your server in uppercase. eg MYSERVER.COM:

aptitude install libc-client2007b libc-client-dev krb5-kdc openssl

Install the packages required for ImageMagick support:

aptitude install libmagick++9-dev imagemagick libmagick10 autoconf

We can now download the php source files. First make sure you are in your home directory.

cd ~

Download the php-5.3.0 source code form the php website:

wget http://us3.php.net/get/php-5.3.0.tar.gz/from/this/mirror

Once the file is done downloading extract the file into your home directory:

tar -xvf php-5.3.0.tar.gz

We are going to add support for ImageMagick. To do this we add the pecl package into the source code so it can be included on compile. Please note ImageMagick can be added after compile and loaded dynamically via the php.ini file. For more information on this method see http://uk.php.net/manual/en/install.pecl.pear.php.

Change directory to the etc directory in your php source directory. This is where php looks for pecl packages:

cd ~/php-5.3.0/ext/

Download, extract and rename the ImageMagick package:

wget http://pecl.php.net/get/imagick-2.2.2.tgz
tar -xvf imagick-2.2.2.tgz
mv imagick-2.2.2 imagick

Change back to the root of the source directory:

cd ~/php-5.3.0/

We now need to generate a new config file that takes into account the addition of ImageMagick. First remove the old config file:

rm configure

Next run the buildconf tool to generate a new config file. You will see some warnings - they can be safely ignored:

./buildconf --force

We can now run the configure command:

./configure -with-mysql=/usr -with-mysqli=/usr/bin/mysql_config -with-tidy=/usr -with-curl=/usr/bin -with-curlwrappers -with-openssl-dir=/usr -with-zlib-dir=/usr -enable-mbstring -with-xpm-dir=/usr -with-pdo-mysql=/usr -with-xsl=/usr -with-ldap -with-xmlrpc -with-iconv-dir=/usr -with-snmp=/usr -enable-exif -enable-calendar -with-bz2=/usr -with-mcrypt=/usr -with-gd -with-jpeg-dir=/usr -with-png-dir=/usr -with-zlib-dir=/usr -with-freetype-dir=/usr -enable-mbstring -enable-zip -with-pear -prefix=/usr/php -with-imap -with-kerberos -with-imap-ssl -with-imagick -with-readline -with-libedit


Assuming there were no errors we can now compile and install php:

make
make install

We now need to enable fastcgi in lighttpd and tell it to use our newly compiled php binary.

First edit the lighttpd fastcgi config file:

nano /etc/lighttpd/conf-available/10-fastcgi.conf


Now enable mod fastcgi and restart lighttpd:

lighttpd-enable-mod fastcgi
/etc/init.d/lighttpd force-reload

To test your php install create the file info.php in the /var/www/ directory:

nano /var/www/info.php


Finally test your install by going to http://myserver/info.php.

Comments

Post a Comment

Popular posts from this blog

UpComing Features in PHP 5.3

Namespaces A subject touched and trialed many times in PHP, namespaces. This feature has been responsible for the longest discussions on PHP-DEV, but finally a consensus has arrived on how this is going to work. The biggest benefit namespaces will provide is shortening of long classnames. To make sure that your class libraries can plug into foreign code, it has always been recommended to prefix your classes, for example "Zend_DB_Connection". This can however lead to very long names. Namespaces fixes this by grouping classes together. The full-on classname becomes Zend::DB:Connection, and by placing 'use Zend::DB' on top of your code, the 'Connection' class can be referenced with just that name. Example: // The class file namespace Zend :: DB ; class Connection { function foo () { echo 'bar' ; } } ?> require 'Zend/DB/Connection.php' ; use Zend :: DB :: Connection ; $connection = new Connection (); $connection -> foo (); ?

Zend Framework WebServices

REST Web Services use service-specific XML formats. These ad-hoc standards mean that the manner for accessing a REST web service is different for each service. REST web services typically use URL parameters (GET data) or path information for requesting data and POST data for sending data. Zend Framework provides both Client and Server capabilities, which, when used together allow for a much more "local" interface experience via virtual object property access. The Server component features automatic exposition of functions and classes using a meaningful and simple XML format. When accessing these services using the Client, it is possible to easily retrieve the return data from the remote call. Should you wish to use the client with a non-Zend_Rest_Server based service, it will still provide easier data access. In addition to Zend_Rest_Server and