1. 安装依赖

    1. 安装依赖前,需要安装apt-get install build-essential autoconf automake libtool bison re2c等编译需要的依赖工具

    2. 安装php的依赖

    1
    2
    
    apt-get install  libxml2-dev libssl-dev     libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libmysqlclient15-dev libpspell-dev librecode-dev libcurl4-gnutls-dev libgmp-dev libgmp3-dev librecode-dev libpspell-dev  libmysqlclient15-dev  libmcrypt-dev  libreadline-dev libtidy-dev libxslt1-dev  -y
    
    
  2. 下载php7.2.3源码wget http://cn2.php.net/distributions/php-7.2.3.tar.gz,解压

  3. 配置

 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/conf.d\
--enable-fpm \
--with-fpm-user=www-data  \
--with-fpm-group=www-data \
--enable-inline-optimization \
--enable-debug \
--disable-rpath \
--enable-shared  \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-pcntl \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir  \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets  \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
  1. 错误configure: error: no acceptable C compiler found in $PATH,执行apt-get install build-essential安装c,gcc之类的东西

  2. 错误 configure: error: Cannot find OpenSSL's libraries,解决方案

    1. ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/

    2. 或者编译安装

    1
    2
    
        wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
    
    

tar zxf openssl-1.0.2k.tar.gz cd openssl-1.0.2k ./config make && make install

```
  1. 错误configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/,解决方案: 1. sudo apt-get install libcurl4-gnutls-dev 2. cd /usr/include sudo ln -s x86_64-linux-gnu/curl

  2. 错误configure: error: freetype-config not found.,解决方案: 1. apt-get install libfreetype6-dev

  3. 错误configure: error: Unable to locate gmp.h解决方案:

    1. apt-get install libgmp-dev
  4. 错误configure: error: Please reinstall readline - I cannot find readline.h,解决方案:

    1. apt-get install libreadline-dev./
  5. make && make install

参考:debian系统安装最新lnmp编译最新php7.1.2及nginx1.10.3及mysql5.7及5.6