Installing Nginx With PHP 5.3 And PHP-FPM On Ubuntu Lucid Lynx (10.04)

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by kjette (Contact Author) (Forums) on Fri, 2010-06-11 13:41. :: Ubuntu | Web Server | nginx | PHP

Installing Nginx With PHP 5.3 And PHP-FPM On Ubuntu Lucid Lynx (10.04)

Follow me on Twitter

http://kjette.se/blog/2010/06/nginx-php-fpm-ubuntu-lucid-lynx/

In this post I will explain how to install Nginx with PHP 5.3.2 and PHP-FPM on Ubuntu Lucid Lynx (10.04-amd64). The Lucid release is a Long-Term Support (LTS), meaning that it will be supported for three years on the desktop and for five years with the server version.

 

Step 0 - Preliminary Notes

In order to complete this tutorial you should have a a base system of Ubuntu 10.04.

 

Step 1 - Install Nginx

apt-get install nginx

 

Step 2 - Install all required dependencies for this installation

apt-get install autoconf2.13 libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev libmcrypt-dev libmysql++-dev libfreetype6-dev libt1-dev libc-client-dev libbz2-dev mysql-client libevent-dev libxml2-dev

 

Step 3 - Download PHP

cd /usr/local/src

wget http://se2.php.net/get/php-5.3.2.tar.gz/from/se.php.net/mirror

tar xzf php-5.3.2.tar.gz

 

Step 4 - Download / Configure PHP-FPM

wget http://github.com/dreamcat4/php-fpm/tarball/0.6-5.3.1

tar xvf dreamcat4-php-fpm-0.6-5.3.0-0-gdd5ebd0.tar.gz

dreamcat4-php-fpm-3bb2b9b/generate-fpm-patch

cd php-5.3.2

patch -p1 < ../fpm.patch

./buildconf --force

mkdir fpm-build && cd fpm-build

 

Step 5 - Configure PHP

Now to configure the commands we should use with PHP, you can add more stuff if you want to. If you are missing something, you can always ask me and I can help you with that also:

../configure --with-fpm --with-libevent=shared --with-mcrypt --enable-mbstring --with-openssl --with-mysql --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --with-sqlite=shared --with-pdo-mysql --with-libxml-dir=/usr/lib --with-mysqli=/usr/bin/mysql_config --with-curl --enable-zip --with-bz2 --enable-soap=shared --with-imap=shared --with-imap-ssl --enable-sockets --with-zlib --enable-exif --enable-ftp --with-iconv --with-gettext --enable-gd-native-ttf --with-t1lib=/usr --with-freetype-dir=/usr --with-kerberos --prefix=/usr/local/php --with-fpm-user=www-data --with-fpm-group=www-data

If everything goes well here (which it should), you can run the following command:

make && make install

 

Step 6 - Configure Nginx

Now you need to download the default vhost configuration, and you can do it here:

wget http://kjette.se/blog/wp-content/downloads/default.tar.gz

tar xzf default.tar.gz

mv default /etc/nginx/sites-available/default

Now we want to reload Nginx by running following command:

/etc/init.d/nginx reload

You are now finished. If you have any questions or concerns, do not hesitate to contact me.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Brian Mercer (not registered) on Mon, 2010-07-12 01:57.

Another option for using php-fpm with Lucid 10.04:

http://launchpad.net/~brianmercer/+archive/php

The patches and compile options are the same ones used by the official Ubuntu Lucid php packages.

Submitted by Dmitri Minaev (not registered) on Tue, 2010-06-15 11:21.

Newer FPM does not require to patch PHP sources. You download it to the PHP source tree, untar and then run PHP compilation as usual. I described the installation process here:

Errors when installing PHP 5.3 with FPM on Ubuntu

Sponsored Links: Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com

One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com

One number. one voicemail. Seize the lead with Sprint. Learn more

AT&T Synaptic Compute as a Service. Boost your power on demand.

Trial: IBM Cognos Express Reporting, Analysis & Planning

Learn benefits of Simpana software.
View the Gartner Video

Sprint 4G - The Ultimate Mobile Broadband
Click here

SAP-Business Objects Crystal Reports Server
Complete reporting without hidden costs. Free Trial