Debian/ubuntu Source Compilation installation php--support fastcgi

Source: Internet
Author: User
Tags configuration php ldap mcrypt openssl version zend

From PHP 5.3.3, you can use PHP-FPM directly, no longer need to patch. Previously written "Linux from source code compiled installation PHP 5" See http://www.linuxidc.com/Linux/2011-10/45743.htm, but in the mod_php module, rather than FastCGI mode to run PHP, and does not apply to LIGHTTPD, Nginx, Litespeed, and at that time all the modules are compiled and installed also seems too cumbersome.

First, what is FastCGI, PHP-FPM, FastCGI?

CGI is a kind of mouth; FastCGI is a CGI extension that makes CGI more efficient; PHP-FPM is a PHP FastCGI manager; spawn-fcgi is a generic FastCGI manager, which is part of LIGHTTPD.

Therefore, to run PHP 5.3.4 in FastCGI mode, there are two main ways, one is php-fpm, and the other is spawn-fcgi, this article is to talk about the PHP-FPM way to run the management of PHP.

Resources:

1,"php-fpm document Chinese translation" Http://www.linuxidc.com/Linux/2011-10/45747.htm
2,"What is CGI, FastCGI, php-cgi, PHP-FPM, spawn-fcgi?" "Http://www.linuxidc.com/Linux/2011-07/38108.htm

Ii. preparatory work

System Environment: UBUNTU-10.10-SERVER-I386
OpenSSL version: openssl-1.0.0c ( see http://www.linuxidc.com/Linux/2011-10/45738.htmfor installation methods)
OpenSSH version: Openssh-5.6p1 ( see http://www.linuxidc.com/Linux/2011-10/45739.htmfor installation method)
MySQL 5 version: Mysql-5.1.53-linux-i686-glibc23 ( installation method See http://www.linuxidc.com/Linux/2011-10/45742.htm )

Third, compile and install php5-gd3.1, install the base compilation environment
1
-Y
3.2, install libpng, libjpeg, Libfreetype
1
-Y
3.3, source code compiled installation Libiconv
12345
wget http:ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gztar -zxf libiconv-1.13.1.tar.gz cd libiconv-1.13.1/.  /configure --prefix=/usr/local make && make   install   
3.4, source code compiled installation gd-2.0.35
12345
wget http:www.libgd.org/releases/gd-2.0.35.tar.gzTar-ZXF gd-2.0.35.tar.gzCD gd-2.0.35/. /configure --prefix=/usr/local Span style= "color: #660033;" >--with-libiconv-prefix=/usr/local --with-png --with-freetype --with-jpegmake &&  Make install        
Iv. compile and install php5 Extension Library 4.1, libxml, Libmhash, Libmcrypt, MCrypt, Libldap, LIBSASL
1
Install Libxml2-dev libmhash-dev libmcrypt-dev mcrypt libldap2-dev libsasl2-dev libssh2-1-dev
4.2. Compile and install curl-7.21.3
12345
wget http:curl.haxx.se/download/curl-7.21.3.tar.gztar -zxf curl-7.21.3.tar.gzcd curl-7.21.3/.  /configure --prefix=/usr/local make && make   install   
V. Compile and install php5.3.4 (FastCGI)
12345678910111213141516171819202122232425262728293031323334353637383940
wget http:Cn.php.net/distributions/php-5.3.4.tar.gzTar-ZXF php-5.3.4.tar.gzCD php-5.3.4/ ./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-openssl=/usr--with-png-dir--with-jpeg-dir--with-freetype-dir--with-iconv-dir=/usr/Local--with-gd=/usr/Local--enable-gd-native-ttf--with-libxml-dir--with-zlib--with-mhash--with-mcrypt--with-ldap--with-ldap-sasl--with-curl=/usr/Local--with-curlwrappers--enable-bcmath--enable-calendar--enable-mbstring--enable-ftp--enable-zip--enable-sockets--enable-exif--enable-zend-multibyte--enable-fpm--with-fpm-user=www-data--with-fpm-group=www-dataMake&&MakeInstallCP Php.ini-production/usr/local/php/lib/php.ini<code>--prefix#指定php5安装目录--with-mysql#指定mysql安装目录--with-mysqli#添加mysqli扩展支持--with-openssl#指定openssl安装目录--with-png-dir#GD所需的png库--with-jpeg-dir#GD所需的jpeg库--with-freetype-dir#指定freetype字体库--with-iconv-dir#指定iconv函数库, for character set conversion--with-gd#指定GD库目录--enable-gd-native-ttf#添加TrueType字符串函数库--with-libxml-dir#指定libxml2库目录--with-zlib#压缩库目录--with-mhash#指定哈希函数库目录--with-mcrypt#指定mcrypt加密函数库--with-ldap#指定ldap库--with-curl#指定cURL库--with-curlwrappers#运用curl工具打开url流--enable-bcmath#高精度数学函数支持--enable-calendar#开启对日历的支持--enable-mbstring#多字节, String support--enable-ftp#开启对ftp的支持--enable-zip#开启对zip的支持--enable-sockets#开启sockets支持--enable-exif#图片元数据支持--enable-zend-multibyte#zend多字节的支持--enable-fpm#开启FastCGI的进程管理支持--with-fpm-user#运行fpm的用户--with-fpm-user#运行fpm的组> Six, Configuration php-fpm><codelang=' Bash '>Cp/usr/local/php/etc/php-fpm.conf.default/ usr/local/phpetc/php-fpm.confvim / usr/local/php/etc/php-fpm.conf            

Look for the following statement and remove the preceding "#" number.

123456
PID = run/php-fpm.piderror_log = log/php-fpm.loglog_level = Noticepm.start_serverspm.min_spare_serverspm.max _spare_servers 
6.2. Auto Restart PHP-FPM
 123 
CP sapi/fpm/ INIT.D.PHP-FPM /etc /init.d/ Php-fpmchmod 755 /etc/init.d /PHP-FPMUPDATE-RC.D php-fpm defaults           

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.