Go Debian/ubuntu install PHP from source code 5.3.4____php

Source: Internet
Author: User
Tags configuration php curl fpm install php ldap openssl openssl version zend

This article source: https://wangyan.org/blog/install-php-fpm-from-source.html

From PHP 5.3.3, you can directly use PHP-FPM, no longer need to patch. Previously had written "Linux compiled from the source code to install PHP 5", but in the mod_php module mode, rather than FastCGI mode to run PHP, and does not apply to LIGHTTPD, Nginx, Litespeed, and at that time for all modules are compiled installation also seems too cumbersome.

Patching: GZIP-CD php-5.2.14-fpm-0.5.14.diff.gz | Patch-d PHP-5.2.14-P1


first, what is FastCGI, PHP-FPM, FastCGI.

CGI is a kind of port; 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 the lighttpd.

Therefore, in FastCGI mode to run the PHP 5.3.4, there are two main ways, one is PHP-FPM, 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"
2, "What is CGI, FastCGI, php-cgi, PHP-FPM, spawn-fcgi." second, the preparation of work

System Environment: UBUNTU-10.10-SERVER-I386
OpenSSL version: openssl-1.0.0c (Installation method)
OpenSSH version: Openssh-5.6p1 (Installation method)
MySQL 5 version: Mysql-5.1.53-linux-i686-glibc23 (Installation method)

Iii. Compiling and installing PHP5-GD 3.1, the installation of the basic compilation environment

1
Apt-get Install Build-essential-y
3.2, install libpng, libjpeg, Libfreetype
1
Apt-get Install Libpng12-dev Libjpeg62-dev libfreetype6-dev-y
3.3, the source code compiles installs Libiconv
1
2
3
4
5
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar-zxf libiconv-1.13.1.tar.gz 
CD LIBICONV-1.13.1/
./configure--prefix=/usr/local make
&& make install
3.4, the source code compiles installs gd-2.0.35
1
2
3
4
5
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
tar-zxf gd-2.0.35.tar.gz
cd gd-2.0.35/
./ Configure--prefix=/usr/local--with-libiconv-prefix=/usr/local--with-png--with-freetype--with-jpeg make
&& make Install
Iv. compiling and installing PHP5 extension Library 4.1, Libxml, Libmhash, Libmcrypt, MCrypt, Libldap, LIBSASL
1
Apt-get Install Libxml2-dev libmhash-dev libmcrypt-dev mcrypt libldap2-dev libsasl2-dev Libssh2-1-dev
4.2. Compile and install curl-7.21.3
1
2
3
4
5
wget http://curl.haxx.se/download/curl-7.21.3.tar.gz
tar-zxf curl-7.21.3.tar.gz
cd curl-7.21.3/
./ Configure--prefix=/usr/local make
&& make install
v. Compile and install php5.3.4 (FastCGI)
1
2
3
4
5
6 7 8 9 (15) An-i-am
)
40 for each and all
wget http://cn.php.net/distributions/php-5.3.4.tar.gz tar-zxf php-5.3.4.tar.gz cd 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-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-data make && make install CP 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函数库, ForCharacter 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 # Use the Curl tool to open the URL stream--enable-bcmath #高精度数学函数支持--enable-calendar #开启对日历的支持--enable-mbstring #多字节, string support--enable-ftp # Open support for FTP--enable-zip #开启对zip的支持--enable-sockets #开启sockets支持--enable-exif #图片元数据支持--enable-zend-multibyte # Zend Multi-byte support--enable-fpm #开启FastCGI的进程管理支持--with-fpm-user #运行fpm的用户--with-fpm-user #运行fpm的组    

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

1
2
3
4
5
6
PID = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
pm.start_servers
pm.min_spare_ Servers
pm.max_spare_servers
6.2, the power-on automatic restart PHP-FPM
1
2
3
CP sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm
chmod 755/etc/init.d/php-fpm
update-rc.d php-fpm Defaults

Other about adding PHP extensions, as well as phpMyAdmin installation configuration See "Linux compiled from the source code to install PHP 5"


Related Article

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.