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

Node.js best practices you should follow

Node.js is a platform built on Chrome’s JavaScript engine (i.e. v8 JavaScript Engine); it helps to develop fast, scalable network application. It is basically used in server side coding, handling AJAX requests, maintaining routes for different APIs and manipulating database. Node.js uses an event-driven, non blocking I/O model that makes it lightweight and efficient. Now without defining v8 the blog will remain incomplete.  v8  is Google’s open source JavaScript engine which is written in C++. Best feature of v8 is: it can run independently, or can be embedded into any C++ application. Let’s come to the main topic; here are the Node.js best practices: 1. Learn the best practices of JavaScript first: Before starting Node.js you should learn the best practices of JavaScript first. It will make your code more decent and flexible. There is a statement code lovers always use, “A fool can write codes which only machines can understand”. So, my suggestion is follo...

JavaScript coding standards we follow

This document’s primary motivation is twofold: 1) code consistency 2) best practices. By  maintaining consistency in coding styles and conventions, we can ease the burden of legacy code maintenance, and mitigate risk of breakage in the future. By adhering to best practices, we ensure optimized page loading, performance and maintainable code. Therefore, at Innofied, we follow these guidelines strictly while programming. 1 . Proper File Naming Conventions a) Use Constructor function name as file names. So as per example, file name will be Hero.js For example: 1 2 3 function Hero ( ) {    this . occupation = ‘ Ninja ’ ; } b) Choose meaningful file names for your JavaScript files like the file names should be derived or chosen by focusing on what the file holds and use CamelCase for your file names. 2 . Indentation a) The unit of indentation is 4 spaces. b) Use of tabs should be avoided. c) Use “format” ...
 Now I am in QA Automation, love of learning something new related to old which is  useful..excites me..:)   Why we use WebDriver as an Interface with ChromeDriver object creation in Java Selenium Automation....stay tuned..coming soon...