debian编译安装php5.5,Debian/Ubuntu 从源码编译安装 PHP 5.3.4

从 php 5.3.3 起,就可直接使用 PHP-FPM ,不再需要打补丁了。此前已写过《Linux 从源码编译安装 PHP 5》 见 http://www.linuxid

从 php 5.3.3 起,就可直接使用 PHP-FPM ,不再需要打补丁了。此前已写过《Linux 从源码编译安装 PHP 5》 见 ,但是以 mod_php 模块方式,而非 FastCGI 模式运行 php ,并不适用于 Lighttpd、Nginx、LiteSpeed ,而且当时对所有模块都采用编译安装也显得过于繁琐。

一、什么是 FastCGI、PHP-FPM、FastCGI ?

CGI是一种口;FastCGI 是 CGI 的扩展,让 CGI 更高效;PHP-FPM 是一个 PHP FastCGI 管理器;同理 Spawn-FCGI 是一个通用的 FastCGI 管理器,,它是 lighttpd 中的一部份。

因此,以 FastCGI 模式运行 php 5.3.4,主要有两种方式,一是 PHP-FPM、二是 Spawn-FCGI ,本文要讲的是以 PHP-FPM 方式运行管理 php。

参考资料:

1、《php-fpm文档中文翻译》

2、《什么是CGI、FastCGI、PHP-CGI、PHP-FPM、Spawn-FCGI?》

二、准备工作

系统环境:Ubuntu-10.10-Server-I386

OpenSSL 版本:openssl-1.0.0c (安装方法见 )

OpenSSH 版本:openssh-5.6p1 (安装方法见 )

MySQL 5 版本:mysql-5.1.53-linux-i686-glibc23 (安装方法见 )

三、编译安装 php5-gd

3.1、安装基础编译环境

1

apt-get install build-essential -y

3.2、安装 libpng、 libjpeg、 libfreetype

1

apt-get install libpng12-dev libjpeg62-dev libfreetype6-dev -y

3.3、源码编译安装 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/

.

3.4、源码编译安装 gd-2.0.35

1

2

3

4

5

wget http:///releases/gd-2.0.35.tar.gz

tar -zxf gd-2.0.35.tar.gz

cd gd-2.0.35/

.=

四、编译安装 php5 扩展库

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、编译安装 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/

.

五、编译安装 php5.3.4 (FastCGI)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

wget http://cn.php.net/distributions/php-5.3.4.tar.gz

tar -zxf php-5.3.4.tar.gz

====www-data php.ini-production /usr/local/php/lib/php.ini

六、配置 php-fpm

usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

vim /usr/local/php/etc/php-fpm.conf

查找下面语句,并将前面"#"号去掉。

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、开机自动重启 php-fpm

1

2

3

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

etc/init.d/php-fpm

update-rc.d php-fpm defaults

其他关于添加php扩展,以及 phpmyadmin 安装配置见《Linux 从源码编译安装 PHP 5》

logo.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
For documentation, browse index.html. Quick install guide: If the sources have been fetched from CVS, run bootstrap.sh [options]. From a released source, use: 1. Type './configure' 2. Type 'make install' Generic configuration instructions are in the file INSTALL. The following 3rd-party libraries will be used by gd if found by configure. While gd will compile and install even without these, we suggest that at least zlib and libpng are installed, and recommend that freetype and jpeg are installed as well: 1. zlib, available from http://www.gzip.org/zlib/ Data compression library 2. libpng, available from http://www.libpng.org/pub/png/ Portable Network Graphics library; requires zlib 3. FreeType 2.x, available from http://www.freetype.org/ Free, high-quality, and portable font engine 4. JPEG library, available from http://www.ijg.org/ Portable JPEG compression/decompression library 5. XPM, available from http://koala.ilog.fr/lehors/xpm.html X Pixmap library If any of these libraries are installed, but not detected by configure, you can use the following command line options: --with-png=DIR Without the DIR argument, configure will check for png header files and libraries in a default location. To switch off png support, use --without-png, or --with-png=no. If the DIR argument is specified, configure tries to find the png header files in DIR/include, and the libraries in DIR/lib. To accommodate OpenBSD ports, DIR/include/libpng is also checked if necessary. --with-freetype=DIR Dto. for freetype 2.x library. The search path for include files is DIR/include/freetype2. --with-jpeg=DIR Dto. for jpeg library. --with-xpm=DIR Dto. for xpm library.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值