centos 7.0 编译安装php 7.0.3

php下载页面

http://cn2.php.net/downloads.php

7.0.3多地区下载页面

http://cn2.php.net/get/php-7.0.3.tar.gz/from/a/mirror

直接下载地址

http://cn2.php.net/distributions/php-7.0.3.tar.gz

下载解压目录

/usr/local/php7.0.3

 下载php压缩包    wget http://cn2.php.net/distributions/php-7.0.3.tar.gz

[root@localhost local]# ls
bin  games    lib    libexec  nginx-1.7.9         nginx-1.9.10         pcre-8.36         sbin   src
etc  include  lib64  nginx    nginx-1.7.9.tar.gz  nginx-1.9.10.tar.gz  pcre-8.36.tar.gz  share
[root@localhost local]# wget http://cn2.php.net/distributions/php-7.0.3.tar.gz
--2016-02-07 04:57:14--  http://cn2.php.net/distributions/php-7.0.3.tar.gz
正在解析主机 cn2.php.net (cn2.php.net)... 220.181.136.55, 220.181.136.30, 220.181.136.43, ...
正在连接 cn2.php.net (cn2.php.net)|220.181.136.55|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:18102258 (17M) [application/x-gzip]
正在保存至: “php-7.0.3.tar.gz”

100%[===============================================================================>] 18,102,258  11.2MB/s 用时 1.5s   

2016-02-07 04:57:16 (11.2 MB/s) - 已保存 “php-7.0.3.tar.gz” [18102258/18102258])

 解压

mkdir php-7.0.3 建立文件夹

tar zxvf php-7.0.3.tar.gz -C /usr/local/php-7.0.3  解压到/usr/local/php-7.0.3 文件夹下

http://www.cnblogs.com/xxx91hx/p/4410188.html

yum -y install flex

[root@localhost local]# yum -y install flex
已加载插件:fastestmirror
base                                                                                              | 3.6 kB  00:00:00     
extras                                                                                            | 3.4 kB  00:00:00     
updates                                                                                           | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.btte.net
 * updates: mirror.bit.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 flex.x86_64.0.2.5.37-3.el7 将被 安装
--> 正在处理依赖关系 m4,它被软件包 flex-2.5.37-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 m4.x86_64.0.1.4.16-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================
 Package                  架构                       版本                                 源                        大小
=========================================================================================================================
正在安装:
 flex                     x86_64                     2.5.37-3.el7                         base                     292 k
为依赖而安装:
 m4                       x86_64                     1.4.16-10.el7                        base                     256 k

事务概要
=========================================================================================================================
安装  1 软件包 (+1 依赖软件包)

总下载量:549 k
安装大小:1.2 M
Downloading packages:
(1/2): m4-1.4.16-10.el7.x86_64.rpm                                                                | 256 kB  00:00:05     
(2/2): flex-2.5.37-3.el7.x86_64.rpm                                                               | 292 kB  00:00:05     
-------------------------------------------------------------------------------------------------------------------------
总计                                                                                      91 kB/s | 549 kB  00:00:06     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : m4-1.4.16-10.el7.x86_64                                                                              1/2 
  正在安装    : flex-2.5.37-3.el7.x86_64                                                                             2/2 
  验证中      : m4-1.4.16-10.el7.x86_64                                                                              1/2 
  验证中      : flex-2.5.37-3.el7.x86_64                                                                             2/2 

已安装:
  flex.x86_64 0:2.5.37-3.el7                                                                                             

作为依赖被安装:
  m4.x86_64 0:1.4.16-10.el7                                                                                              

完毕!

  yum -y install libxml2-devel

[root@localhost local]# yum -y install libxml2-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.sina.cn
 * updates: mirrors.sina.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 libxml2-devel.x86_64.0.2.9.1-6.el7_2.2 将被 安装
--> 正在处理依赖关系 libxml2 = 2.9.1-6.el7_2.2,它被软件包 libxml2-devel-2.9.1-6.el7_2.2.x86_64 需要
--> 正在处理依赖关系 xz-devel,它被软件包 libxml2-devel-2.9.1-6.el7_2.2.x86_64 需要
--> 正在检查事务
---> 软件包 libxml2.x86_64.0.2.9.1-5.el7_0.1 将被 升级
---> 软件包 libxml2.x86_64.0.2.9.1-6.el7_2.2 将被 更新
---> 软件包 xz-devel.x86_64.0.5.1.2-12alpha.el7 将被 安装
--> 正在处理依赖关系 xz-libs = 5.1.2-12alpha.el7,它被软件包 xz-devel-5.1.2-12alpha.el7.x86_64 需要
--> 正在检查事务
---> 软件包 xz-libs.x86_64.0.5.1.2-8alpha.el7 将被 升级
--> 正在处理依赖关系 xz-libs = 5.1.2-8alpha.el7,它被软件包 xz-5.1.2-8alpha.el7.x86_64 需要
---> 软件包 xz-libs.x86_64.0.5.1.2-12alpha.el7 将被 更新
--> 正在检查事务
---> 软件包 xz.x86_64.0.5.1.2-8alpha.el7 将被 升级
---> 软件包 xz.x86_64.0.5.1.2-12alpha.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================
 Package                       架构                   版本                                 源                       大小
=========================================================================================================================
正在安装:
 libxml2-devel                 x86_64                 2.9.1-6.el7_2.2                      updates                 1.0 M
为依赖而安装:
 xz-devel                      x86_64                 5.1.2-12alpha.el7                    base                     44 k
为依赖而更新:
 libxml2                       x86_64                 2.9.1-6.el7_2.2                      updates                 666 k
 xz                            x86_64                 5.1.2-12alpha.el7                    base                    200 k
 xz-libs                       x86_64                 5.1.2-12alpha.el7                    base                    102 k

事务概要
=========================================================================================================================
安装  1 软件包 (+1 依赖软件包)
升级           ( 3 依赖软件包)

总下载量:2.0 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/5): xz-devel-5.1.2-12alpha.el7.x86_64.rpm                                                      |  44 kB  00:00:00     
(2/5): xz-5.1.2-12alpha.el7.x86_64.rpm                                                            | 200 kB  00:00:00     
(3/5): xz-libs-5.1.2-12alpha.el7.x86_64.rpm                                                       | 102 kB  00:00:00     
(4/5): libxml2-2.9.1-6.el7_2.2.x86_64.rpm                                                         | 666 kB  00:00:00     
(5/5): libxml2-devel-2.9.1-6.el7_2.2.x86_64.rpm                                                   | 1.0 MB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------
总计                                                                                     4.3 MB/s | 2.0 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : xz-libs-5.1.2-12alpha.el7.x86_64                                                                     1/8 
  正在安装    : xz-devel-5.1.2-12alpha.el7.x86_64                                                                    2/8 
  正在更新    : libxml2-2.9.1-6.el7_2.2.x86_64                                                                       3/8 
  正在安装    : libxml2-devel-2.9.1-6.el7_2.2.x86_64                                                                 4/8 
  正在更新    : xz-5.1.2-12alpha.el7.x86_64                                                                          5/8 
  清理        : libxml2-2.9.1-5.el7_0.1.x86_64                                                                       6/8 
  清理        : xz-5.1.2-8alpha.el7.x86_64                                                                           7/8 
  清理        : xz-libs-5.1.2-8alpha.el7.x86_64                                                                      8/8 
  验证中      : xz-5.1.2-12alpha.el7.x86_64                                                                          1/8 
  验证中      : xz-devel-5.1.2-12alpha.el7.x86_64                                                                    2/8 
  验证中      : libxml2-2.9.1-6.el7_2.2.x86_64                                                                       3/8 
  验证中      : xz-libs-5.1.2-12alpha.el7.x86_64                                                                     4/8 
  验证中      : libxml2-devel-2.9.1-6.el7_2.2.x86_64                                                                 5/8 
  验证中      : xz-libs-5.1.2-8alpha.el7.x86_64                                                                      6/8 
  验证中      : xz-5.1.2-8alpha.el7.x86_64                                                                           7/8 
  验证中      : libxml2-2.9.1-5.el7_0.1.x86_64                                                                       8/8 

已安装:
  libxml2-devel.x86_64 0:2.9.1-6.el7_2.2                                                                                 

作为依赖被安装:
  xz-devel.x86_64 0:5.1.2-12alpha.el7                                                                                    

作为依赖被升级:
  libxml2.x86_64 0:2.9.1-6.el7_2.2        xz.x86_64 0:5.1.2-12alpha.el7        xz-libs.x86_64 0:5.1.2-12alpha.el7       

完毕!

  

编译php

此时目录 /usr/local/php-7.0.3/php-7.0.3

[root@localhost php-7.0.3]# ./configure --prefix=/usr/etc/php703 --with-config-file-path=/usr/etc/php703/etc --with-config-scan-dir=/usr/etc/php703/etc --enable-fpm --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-re2c-cgoto --with-libdir=/usr/etc/php703/lib/php/extensions/no-debug-non-zts-20131226
configure: WARNING: unrecognized options: --with-config-scan-dir, --with-mysql
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... /usr/etc/php703/lib/php/extensions/no-debug-non-zts-20131226
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... gawk
checking for bison... no
checking for byacc... no
checking for bison version... invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ).
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to enable computed goto gcc extension with re2c... yes
checking whether re2c -g works... yes
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking whether /dev/arandom exists... no
checking for global register variables support... yes
checking for pthreads_cflags... -pthread
checking for pthreads_lib... 

Configuring SAPI modules
checking for Apache 2.0 handler-module support via DSO through APXS... no
checking for setproctitle... no
checking sys/pstat.h usability... no
checking sys/pstat.h presence... no
checking for sys/pstat.h... no
checking for PS_STRINGS... no
checking for CLI build... yes
checking for embedded SAPI library support... no
checking for FPM build... yes
checking for setenv... yes
checking for clearenv... yes
checking for setproctitle... (cached) no
checking for library containing socket... none required
checking for library containing inet_addr... none required
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sysexits.h usability... yes
checking sysexits.h presence... yes
checking for sysexits.h... yes
checking for prctl... yes
checking for clock_gettime... yes
checking for ptrace... yes
checking whether ptrace works... yes
checking for proc mem file... mem
checking if gcc supports __sync_bool_compare_and_swap... yes
checking for TCP_INFO... yes
checking for sysconf... yes
checking for times... yes
checking for kqueue... no
checking for port framework... no
checking for /dev/poll... no
checking for epoll... yes
checking for poll... yes
checking for select... yes
checking for apparmor... no
checking for LiteSpeed support... no
checking for phpdbg support... yes
checking for phpdbg web SAPI support... no
checking for phpdbg debug build... no
checking whether termios.h defines TIOCGWINSZ... no
checking whether sys/ioctl.h defines TIOCGWINSZ... yes
checking for CGI build... yes
checking for socklen_t in sys/socket.h... yes
checking for sun_len in sys/un.h... no
checking whether cross-process locking is required by accept()... no
checking for chosen SAPI module... none
checking for executable SAPI binaries...  cli fpm phpdbg cgi

Running system checks
checking for sendmail... /usr/sbin/sendmail
checking whether system uses EBCDIC... no
checking whether byte ordering is bigendian... no
checking whether writing to stdout works... This is the test message -- yes
checking for socket... yes
checking for socketpair... yes
checking for htonl... yes
checking for gethostname... yes
checking for gethostbyaddr... yes
checking for yp_get_default_domain... no
checking for __yp_get_default_domain... no
checking for yp_get_default_domain in -lnsl... yes
checking for dlopen... no
checking for __dlopen... no
checking for dlopen in -ldl... yes
checking for sin in -lm... yes
checking for inet_aton... yes
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for dirent.h... yes
checking for ApplicationServices/ApplicationServices.h... no
checking for sys/param.h... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for netinet/in.h... (cached) yes
checking for alloca.h... yes
checking for arpa/inet.h... (cached) yes
checking for arpa/nameser.h... yes
checking for assert.h... yes
checking for crypt.h... yes
checking for dns.h... no
checking for fcntl.h... (cached) yes
checking for grp.h... yes
checking for ieeefp.h... no
checking for langinfo.h... yes
checking for limits.h... yes
checking for locale.h... yes
checking for monetary.h... yes
checking for netdb.h... yes
checking for pwd.h... yes
checking for resolv.h... yes
checking for signal.h... yes
checking for stdarg.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for syslog.h... yes
checking for sysexits.h... (cached) yes
checking for sys/ioctl.h... yes
checking for sys/file.h... yes
checking for sys/mman.h... yes
checking for sys/mount.h... yes
checking for sys/poll.h... yes
checking for sys/resource.h... yes
checking for sys/select.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for sys/statfs.h... yes
checking for sys/statvfs.h... yes
checking for sys/vfs.h... yes
checking for sys/sysexits.h... no
checking for sys/varargs.h... no
checking for sys/wait.h... yes
checking for sys/loadavg.h... no
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking for unix.h... no
checking for utime.h... yes
checking for sys/utsname.h... yes
checking for sys/ipc.h... yes
checking for dlfcn.h... yes
checking for assert.h... (cached) yes
checking for fopencookie... yes
checking for broken getcwd... no
checking for broken libc stdio... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for missing declarations of reentrant functions... done
checking for fclose declaration... ok
checking for tm_gmtoff in struct tm... yes
checking for struct flock... yes
checking for socklen_t... yes
checking size of size_t... 8
checking size of long long... 8
checking size of long long int... 8
checking size of long... 8
checking size of int... 4
checking size of intmax_t... 8
checking size of ssize_t... 8
checking size of ptrdiff_t... 8
checking size of short... 2
checking size of int... (cached) 4
checking size of long... (cached) 8
checking size of long long... (cached) 8
checking for int8... no
checking for int16... no
checking for int32... no
checking for int64... no
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for uint8... no
checking for uint16... no
checking for uint32... no
checking for uint64... no
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for u_int8_t... yes
checking for u_int16_t... yes
checking for u_int32_t... yes
checking for u_int64_t... yes
checking for __builtin_expect... yes
checking for __builtin_clz... yes
checking for __builtin_ctzl... yes
checking for __builtin_ctzll... yes
checking for struct stat.st_blksize... yes
checking for struct stat.st_blocks... yes
checking for struct stat.st_rdev... yes
checking for size_t... yes
checking for uid_t in sys/types.h... yes
checking for struct sockaddr_storage... yes
checking for field sa_len in struct sockaddr... no
checking for IPv6 support... yes
checking for vprintf... yes
checking for _doprnt... no
checking for alphasort... yes
checking for asctime_r... yes
checking for chroot... yes
checking for ctime_r... yes
checking for cuserid... yes
checking for crypt... no
checking for flock... yes
checking for ftok... yes
checking for funopen... no
checking for gai_strerror... yes
checking for gcvt... yes
checking for getloadavg... yes
checking for getlogin... yes
checking for getprotobyname... yes
checking for getprotobynumber... yes
checking for getservbyname... yes
checking for getservbyport... yes
checking for gethostname... (cached) yes
checking for getrusage... yes
checking for gettimeofday... yes
checking for gmtime_r... yes
checking for getpwnam_r... yes
checking for getgrnam_r... yes
checking for getpwuid_r... yes
checking for grantpt... yes
checking for inet_ntoa... yes
checking for inet_ntop... yes
checking for inet_pton... yes
checking for isascii... yes
checking for link... yes
checking for localtime_r... yes
checking for lockf... yes
checking for lchown... yes
checking for lrand48... yes
checking for memcpy... yes
checking for memmove... yes
checking for mkstemp... yes
checking for mmap... yes
checking for nl_langinfo... yes
checking for perror... yes
checking for poll... yes
checking for ptsname... yes
checking for putenv... yes
checking for realpath... yes
checking for random... yes
checking for rand_r... yes
checking for scandir... yes
checking for setitimer... yes
checking for setlocale... yes
checking for localeconv... yes
checking for setenv... (cached) yes
checking for setpgid... yes
checking for setsockopt... yes
checking for setvbuf... yes
checking for shutdown... yes
checking for sin... yes
checking for snprintf... yes
checking for srand48... yes
checking for srandom... yes
checking for statfs... yes
checking for statvfs... yes
checking for std_syslog... no
checking for strcasecmp... yes
checking for strcoll... yes
checking for strdup... yes
checking for strerror... yes
checking for strftime... yes
checking for strnlen... yes
checking for strptime... yes
checking for strstr... yes
checking for strtok_r... yes
checking for symlink... yes
checking for tempnam... yes
checking for tzset... yes
checking for unlockpt... yes
checking for unsetenv... yes
checking for usleep... yes
checking for utime... yes
checking for vsnprintf... yes
checking for vasprintf... yes
checking for asprintf... yes
checking for nanosleep... yes
checking for nanosleep in -lrt... yes
checking for getaddrinfo... yes
checking for __sync_fetch_and_add... yes
checking for strlcat... no
checking for strlcpy... no
checking for getopt... yes
checking for utime.h... (cached) yes
checking whether utime accepts a null argument... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for declared timezone... yes
checking for type of reentrant time-related functions... POSIX
checking for readdir_r... yes
checking for type of readdir_r... POSIX
checking for in_addr_t... yes
checking for crypt_r... no

General settings
checking whether to include gcov symbols... no
checking whether to include debugging symbols... no
checking layout of installed files... PHP
checking path to configuration file... /usr/etc/php703/etc
checking where to scan for configuration files... 
checking whether to enable PHP's own SIGCHLD handler... no
checking whether to explicitly link against libgcc... no
checking whether to enable short tags by default... yes
checking whether to enable dmalloc... no
checking whether to enable IPv6 support... yes
checking whether to enable DTrace support... no
checking how big to make fd sets... using system default

Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path... /usr/bin/xml2-config
checking whether libxml build works... yes
checking for OpenSSL support... no
checking for Kerberos support... no
checking whether to use system default cipher list instead of hardcoded value... no
checking for PCRE library to use... bundled
checking whether to enable the SQLite3 extension... yes
checking bundled sqlite3 library... yes
checking for ZLIB support... no
checking if the location of ZLIB install directory is defined... no
checking whether to enable bc style precision math functions... no
checking for BZip2 support... no
checking whether to enable calendar conversion support... no
checking whether to enable ctype functions... yes
checking for cURL support... no
checking for QDBM support... no
checking for GDBM support... no
checking for NDBM support... no
checking for TCADB support... no
checking for Berkeley DB4 support... no
checking for Berkeley DB3 support... no
checking for Berkeley DB2 support... no
checking for DB1 support... no
checking for DBM support... no
checking for CDB support... no
checking for INI File support... no
checking for FlatFile support... no
checking whether to enable DBA interface... no
checking whether to enable DOM support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking for ENCHANT support... no
checking whether to enable EXIF (metadata from images) support... no
checking for fileinfo support... yes
checking for strcasestr... yes
checking for utimes... yes
checking for strndup... yes
checking whether to enable input filter support... yes
checking pcre install prefix... no
checking whether to enable FTP support... no
checking OpenSSL dir for FTP... no
checking for GD support... no
checking for the location of libwebp... no
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 2... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for GNU gettext support... no
checking for GNU MP support... no
checking for mhash support... no
checking whether to enable hash support... yes
checking whether byte ordering is bigendian... (cached) no
checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 8
checking size of long long... (cached) 8
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... yes
checking if iconv supports //IGNORE... no
checking if your cpp allows macro usage in include lines... yes
checking for IMAP support... no
checking for IMAP Kerberos support... no
checking for IMAP SSL support... no
checking for Firebird support... no
checking whether to enable internationalization support... no
checking whether to enable JavaScript Object Serialization support... yes
checking for ANSI C header files... (cached) yes
checking for LDAP support... no
checking for LDAP Cyrus SASL support... no
checking whether to enable multibyte string support... no
checking whether to enable multibyte regex support... yes
checking whether to check multibyte regex backtrack... yes
checking for external libmbfl... no
checking for external oniguruma... no
checking for mcrypt support... no
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for Oracle Database OCI8 support... no
checking for Adabas support... no
checking for SAP DB support... no
checking for Solid support... no
checking for IBM DB2 support... no
checking for ODBCRouter.com support... no
checking for Empress support... no
checking for Empress local access support... no
checking for Birdstep support... no
checking for a custom ODBC support... no
checking for iODBC support... no
checking for Easysoft ODBC-ODBC Bridge support... no
checking for unixODBC support... no
checking for DBMaker support... no
checking for any ODBC driver support... no
checking whether to enable Zend OPcache support... yes
checking whether to enable file based caching... yes
checking whether to enable copying PHP CODE pages into HUGE PAGES... yes
checking for mprotect... yes
checking for unistd.h... (cached) yes
checking for sys/uio.h... (cached) yes
checking for sysvipc shared memory support... yes
checking for mmap() using MAP_ANON shared memory support... yes
checking for mmap() using /dev/zero shared memory support... yes
checking for mmap() using shm_open() shared memory support... yes
checking for mmap() using regular file shared memory support... yes
checking "whether flock struct is linux ordered"... "yes"
checking "whether flock struct is BSD ordered"... "no"
checking whether to enable pcntl support... no
checking whether to enable PDO support... yes
checking for PDO_DBLIB support via FreeTDS... no
checking for Firebird support for PDO... no
checking for MySQL support for PDO... yes
checking for MySQL UNIX socket location... no
checking for PDO includes... checking for PDO includes... /usr/local/php-7.0.3/php-7.0.3/ext
checking Oracle OCI support for PDO... no
checking for ODBC v3 support for PDO... no
checking for PostgreSQL support for PDO... no
checking for sqlite 3 support for PDO... yes
checking for PDO includes... (cached) /usr/local/php-7.0.3/php-7.0.3/ext
checking for usleep... (cached) yes
checking for nanosleep... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for fdatasync in -lrt... yes
checking for PostgreSQL support... no
checking for phar archive support... yes
checking for phar openssl support... no
checking whether to enable POSIX-like functions... yes
checking sys/mkdev.h usability... no
checking sys/mkdev.h presence... no
checking for sys/mkdev.h... no
checking for seteuid... yes
checking for setegid... yes
checking for setsid... yes
checking for getsid... yes
checking for setpgid... (cached) yes
checking for getpgid... yes
checking for ctermid... yes
checking for mkfifo... yes
checking for mknod... yes
checking for setrlimit... yes
checking for getrlimit... yes
checking for getlogin... (cached) yes
checking for getgroups... yes
checking for makedev... no
checking for initgroups... yes
checking for getpwuid_r... (cached) yes
checking for getgrgid_r... yes
checking for working ttyname_r() implementation... no, posix_ttyname() will be thread-unsafe
checking for utsname.domainname... yes
checking for PSPELL support... no
checking for libedit readline replacement... no
checking for readline support... no
checking for recode support... no
checking whether to enable PHP sessions... yes
checking for mm support... no
checking whether pwrite works... yes
checking whether pread works... yes
checking whether to enable shmop support... no
checking whether to enable SimpleXML support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking for SNMP support... no
checking OpenSSL dir for SNMP... no
checking whether to enable SOAP support... no
checking whether to enable sockets support... no
checking whether flush should be called explicitly after a buffered io... no
checking for crypt in -lcrypt... yes
checking for standard DES crypt... yes
checking for extended DES crypt... no
checking for MD5 crypt... yes
checking for Blowfish crypt... no
checking for SHA512 crypt... yes
checking for SHA256 crypt... yes
checking whether the compiler supports __alignof__... yes
checking whether the compiler supports aligned attribute... yes
checking for getcwd... yes
checking for getwd... yes
checking for asinh... yes
checking for acosh... yes
checking for atanh... yes
checking for log1p... yes
checking for hypot... yes
checking for glob... yes
checking for strfmon... yes
checking for nice... yes
checking for fpclass... no
checking for isinf... yes
checking for isnan... yes
checking for mempcpy... yes
checking for strpncpy... no
checking for working POSIX fnmatch... yes
checking for fork... yes
checking if your OS can spawn processes with inherited handles... yes
checking for res_nsearch... no
checking for __res_nsearch... no
checking for res_nsearch in -lresolv... no
checking for __res_nsearch in -lresolv... yes
checking for dns_search... no
checking for __dns_search... no
checking for dns_search in -lresolv... no
checking for __dns_search in -lresolv... no
checking for dns_search in -lbind... no
checking for __dns_search in -lbind... no
checking for dns_search in -lsocket... no
checking for __dns_search in -lsocket... no
checking for dn_expand... no
checking for __dn_expand... yes
checking for dn_skipname... no
checking for __dn_skipname... yes
checking for res_search... no
checking for __res_search... yes
checking whether atof() accepts NAN... yes
checking whether atof() accepts INF... yes
checking whether HUGE_VAL == INF... yes
checking whether HUGE_VAL + -HUGEVAL == NAN... yes
checking whether strptime() declaration fails... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for mblen... yes
checking for mbrlen... yes
checking for mbsinit... yes
checking for mbstate_t... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking whether arc4random_buf is declared... no
checking whether getrandom is declared... no
checking whether to enable System V IPC support... no
checking whether to enable System V semaphore support... no
checking whether to enable System V shared memory support... no
checking for TIDY support... no
checking whether to enable tokenizer support... yes
checking whether to enable WDDX support... no
checking libexpat dir for WDDX... no
checking whether to enable XML support... yes
checking libexpat install dir... no
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking whether to enable XMLReader support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking for XMLRPC-EPI support... no
checking libexpat dir for XMLRPC-EPI... no
checking iconv dir for XMLRPC-EPI... no
checking whether to enable XMLWriter support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking for XSL support... no
checking for zip archive read/writesupport... no
checking pcre install prefix... no
checking libzip... no
checking whether to enable mysqlnd... yes
checking whether to disable compressed protocol support in mysqlnd... yes

Configuring PEAR
checking whether to install PEAR... yes

Configuring Zend
checking for bison version... (cached) invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ).
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for limits.h... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for stdarg.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for signal.h... (cached) yes
checking for unix.h... (cached) no
checking for stdlib.h... (cached) yes
checking for dlfcn.h... (cached) yes
checking for size_t... (cached) yes
checking return type of signal handlers... void
checking for uint... yes
checking for ulong... yes
checking for int32_t... yes
checking for uint32_t... yes
checking for vprintf... (cached) yes
checking for _doprnt... (cached) no
checking for working memcmp... yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for memcpy... (cached) yes
checking for strdup... (cached) yes
checking for getpid... yes
checking for kill... yes
checking for strtod... yes
checking for strtol... yes
checking for finite... yes
checking for fpclass... (cached) no
checking for sigsetjmp... no
checking whether sprintf is broken... no
checking for finite... (cached) yes
checking for isfinite... no
checking for isinf... (cached) yes
checking for isnan... (cached) yes
checking whether fp_except is defined... no
checking for usable _FPU_SETCW... yes
checking for usable fpsetprec... no
checking for usable _controlfp... no
checking for usable _controlfp_s... no
checking whether FPU control word can be manipulated by inline assembler... yes
checking whether double cast to long preserves least significant bits... no
checking for dlfcn.h... (cached) yes
checking whether dlsym() requires a leading underscore in symbol names... no
checking whether to enable thread-safety... no
checking whether to enable inline optimization for GCC... yes
checking whether to enable Zend debugging... no
checking for inline... inline
checking target system is Darwin... no
checking for MM alignment and log values... done
checking for memory allocation using mmap(MAP_ANON)... yes
checking for memory allocation using mmap("/dev/zero")... yes
checking for mremap... yes
checking for sigaction... yes
checking whether to enable zend signal handling... no

Configuring TSRM
checking for stdarg.h... (cached) yes
checking for sigprocmask... yes

Configuring libtool
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking how to recognize dependent libraries... pass_all
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes

creating libtool
appending configuration tag "CXX" to libtool

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --with-config-scan-dir, --with-mysql

  make

make install

[root@localhost php-7.0.3]# make install
Installing shared extensions:     /usr/etc/php703/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary:        /usr/etc/php703/bin/
Installing PHP CLI man page:      /usr/etc/php703/php/man/man1/
Installing PHP FPM binary:        /usr/etc/php703/sbin/
Installing PHP FPM config:        /usr/etc/php703/etc/
Installing PHP FPM man page:      /usr/etc/php703/php/man/man8/
Installing PHP FPM status page:      /usr/etc/php703/php/php/fpm/
Installing phpdbg binary:         /usr/etc/php703/bin/
Installing phpdbg man page:       /usr/etc/php703/php/man/man1/
Installing PHP CGI binary:        /usr/etc/php703/bin/
Installing PHP CGI man page:      /usr/etc/php703/php/man/man1/
Installing build environment:     /usr/etc/php703/lib/php/build/
Installing header files:          /usr/etc/php703/include/php/
Installing helper programs:       /usr/etc/php703/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/etc/php703/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/etc/php703/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.3.0
[PEAR] PEAR           - installed: 1.10.1
Wrote PEAR system config file at: /usr/etc/php703/etc/pear.conf
You may want to add: /usr/etc/php703/lib/php to your php.ini include_path
/usr/local/php-7.0.3/php-7.0.3/build/shtool install -c ext/phar/phar.phar /usr/etc/php703/bin
ln -s -f phar.phar /usr/etc/php703/bin/phar
Installing PDO headers:          /usr/etc/php703/include/php/ext/pdo/

配置php.ini

php解压目录php.ini复制到安装目录里 

安装目录/usr/etc/php703/etc

解压目录/usr/local/php-7.0.3/php-7.0.3  下图是解压目录

复制文件(/usr/local/php-7.0.3/php-7.0.3) 同时重命名为php.ini复制到安装目录下

[root@localhost php-7.0.3]# cp php.ini-production /usr/etc/php703/etc/php.ini

vi  /usr/etc/php703/etc/php.ini

rm 文件名 删除文件名

命令行 按i键进入插入模式 编辑php.ini 按键在命令行里输入向下查找(/) 没有在向上查找(?) ,搜索timezone. 

找到date.timezone 去掉前面的 #号,给值 date.timezone = PRC

:wq 退出保存后。

配置php-fpm.conf

[root@localhost etc]# cd /usr/etc/php703/etc
[root@localhost etc]# ls
pear.conf  php-fpm.conf.default  php-fpm.d  php.ini

  

[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# ls
pear.conf  php-fpm.conf  php-fpm.conf.default  php-fpm.d  php.ini

  

vi php-fpm.conf

pid = run/php-fpm.pid #取消前面的分号

php-fpm配置文件www.conf

[root@localhost php-fpm.d]# cd /usr/etc/php703/etc/php-fpm.d
[root@localhost php-fpm.d]# ls
www.conf  www.conf.default

 命令行常用VI命令 

:w   保存文件但不退出vi
:w file 将修改另外保存到file中,不退出vi
:w!   强制保存,不推出vi
:wq  保存文件并退出vi
:wq! 强制保存文件,并退出vi
q:  不保存文件,退出vi
:q! 不保存文件,强制退出vi
:e! 放弃所有修改,从上次保存文件开始再编辑

 www.conf默认文件参数

修改

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www
group = www

listen = 127.0.0.1:9000 端口改下 9089

启动php-fpm

usr/etc/php703/sbin/php-fpm

 

; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]

; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr/etc/php703) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = nobody
group = nobody

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
;                            a specific port;
;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =

; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1

; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
;       - The pool processes will inherit the master process priority
;         unless it specified otherwise
; Default Value: no set
; process.priority = -19

; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives. With this process management, there will be
;             always at least 1 children.
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
;  ondemand - no children are created at startup. Children will be forked when
;             new requests will connect. The following parameter are used:
;             pm.max_children           - the maximum number of children that
;                                         can be alive at the same time.
;             pm.process_idle_timeout   - The number of seconds after which
;                                         an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3

; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500

; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
;   pool                 - the name of the pool;
;   process manager      - static, dynamic or ondemand;
;   start time           - the date and time FPM has started;
;   start since          - number of seconds since FPM has started;
;   accepted conn        - the number of request accepted by the pool;
;   listen queue         - the number of request in the queue of pending
;                          connections (see backlog in listen(2));
;   max listen queue     - the maximum number of requests in the queue
;                          of pending connections since FPM has started;
;   listen queue len     - the size of the socket queue of pending connections;
;   idle processes       - the number of idle processes;
;   active processes     - the number of active processes;
;   total processes      - the number of idle + active processes;
;   max active processes - the maximum number of active processes since FPM
;                          has started;
;   max children reached - number of times, the process limit has been reached,
;                          when pm tries to start more children (works only for
;                          pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
;   pool:                 www
;   process manager:      static
;   start time:           01/Jul/2011:17:53:49 +0200
;   start since:          62636
;   accepted conn:        190460
;   listen queue:         0
;   max listen queue:     1
;   listen queue len:     42
;   idle processes:       4
;   active processes:     11
;   total processes:      15
;   max active processes: 12
;   max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
;   http://www.foo.bar/status
;   http://www.foo.bar/status?json
;   http://www.foo.bar/status?html
;   http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
;   http://www.foo.bar/status?full
;   http://www.foo.bar/status?json&full
;   http://www.foo.bar/status?html&full
;   http://www.foo.bar/status?xml&full
; The Full status returns for each process:
;   pid                  - the PID of the process;
;   state                - the state of the process (Idle, Running, ...);
;   start time           - the date and time the process has started;
;   start since          - the number of seconds since the process has started;
;   requests             - the number of requests the process has served;
;   request duration     - the duration in µs of the requests;
;   request method       - the request method (GET, POST, ...);
;   request URI          - the request URI with the query string;
;   content length       - the content length of the request (only with POST);
;   user                 - the user (PHP_AUTH_USER) (or '-' if not set);
;   script               - the main script called (or '-' if not set);
;   last request cpu     - the %cpu the last request consumed
;                          it's always 0 if the process is not in Idle state
;                          because CPU calculation is done when the request
;                          processing has terminated;
;   last request memory  - the max amount of memory the last request consumed
;                          it's always 0 if the process is not in Idle state
;                          because memory calculation is done when the request
;                          processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
;   ************************
;   pid:                  31330
;   state:                Running
;   start time:           01/Jul/2011:17:53:49 +0200
;   start since:          63087
;   requests:             12808
;   request duration:     1250261
;   request method:       GET
;   request URI:          /test_mem.php?N=10000
;   content length:       0
;   user:                 -
;   script:               /home/fat/web/docs/php/test_mem.php
;   last request cpu:     0.00
;   last request memory:  0
;
; Note: There is a real-time FPM status monitoring sample web page available
;       It's available in: /usr/etc/php703/share/php/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status

; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping

; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong

; The access log file
; Default: not set
;access.log = log/$pool.access.log

; The access log format.
; The following syntax is allowed
;  %%: the '%' character
;  %C: %CPU used by the request
;      it can accept the following format:
;      - %{user}C for user CPU only
;      - %{system}C for system CPU only
;      - %{total}C  for user + system CPU (default)
;  %d: time taken to serve the request
;      it can accept the following format:
;      - %{seconds}d (default)
;      - %{miliseconds}d
;      - %{mili}d
;      - %{microseconds}d
;      - %{micro}d
;  %e: an environment variable (same as $_ENV or $_SERVER)
;      it must be associated with embraces to specify the name of the env
;      variable. Some exemples:
;      - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
;      - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
;  %f: script filename
;  %l: content-length of the request (for POST request only)
;  %m: request method
;  %M: peak of memory allocated by PHP
;      it can accept the following format:
;      - %{bytes}M (default)
;      - %{kilobytes}M
;      - %{kilo}M
;      - %{megabytes}M
;      - %{mega}M
;  %n: pool name
;  %o: output header
;      it must be associated with embraces to specify the name of the header:
;      - %{Content-Type}o
;      - %{X-Powered-By}o
;      - %{Transfert-Encoding}o
;      - ....
;  %p: PID of the child that serviced the request
;  %P: PID of the parent of the child that serviced the request
;  %q: the query string
;  %Q: the '?' character if query string exists
;  %r: the request URI (without the query string, see %q and %Q)
;  %R: remote IP address
;  %s: status (response code)
;  %t: server time the request was received
;      it can accept a strftime(3) format:
;      %d/%b/%Y:%H:%M:%S %z (default)
;      The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
;  %T: time the log has been written (the request has finished)
;      it can accept a strftime(3) format:
;      %d/%b/%Y:%H:%M:%S %z (default)
;      The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
;  %u: remote user
;
; Default: "%R - %u %t "%m %r" %s"
;access.format = "%R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%%"

; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
;slowlog = log/$pool.log.slow

; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0

; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024

; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
;       possible. However, all PHP paths will be relative to the chroot
;       (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =

; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes

; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no

; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7

; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp

; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
;   php_value/php_flag             - you can set classic ini defines which can
;                                    be overwritten from PHP call 'ini_set'.
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
;                                     PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.

; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr/etc/php703)

; Default Value: nothing is defined by default except the values in php.ini and
;                specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

  

[root@localhost etc]# vi php-fpm.conf

;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr/etc/php703). This prefix can be dynamically changed by using the
; '-p' argument from the command line.

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Note: the default prefix is /usr/etc/php703/var
; Default Value: none
pid = run/php-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /usr/etc/php703/var
; Default Value: log/php-fpm.log
;error_log = log/php-fpm.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated.  This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0

; The maximum number of processes FPM will fork. This has been design to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
; process.max = 128

; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
;       - The pool process will inherit the master process priority
;         unless it specified otherwise
; Default Value: no set
; process.priority = -19

; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
;daemonize = yes

; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024

; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

; Specify the event mechanism FPM will use. The following is available:
; - select     (any POSIX os)
; - poll       (any POSIX os)
; - epoll      (linux >= 2.5.44)
; - kqueue     (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
; - /dev/poll  (Solaris >= 7)
; - port       (Solaris >= 10)
; Default Value: not set (auto detection)
;events.mechanism = epoll

; When FPM is build with systemd integration, specify the interval,
; in second, between health report notification to systemd.
; Set to 0 to disable.
; Available Units: s(econds), m(inutes), h(ours)
; Default Unit: seconds
; Default value: 10
;systemd_interval = 10

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different listening
; ports and different management options.  The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
;  - the global prefix if it's been set (-p argument)
;  - /usr/etc/php703 otherwise
include=/usr/etc/php703/etc/php-fpm.d/*.conf

 开机启动php-fpm(暂时没有成功)


复制php-fpm到启动目录/etc/init.d

 

[root@localhost sbin]# cp /usr/etc/php703/sbin/php-fpm /etc/init.d/php-fpm

 给权限

 

[root@localhost sbin]# chmod 775 /etc/init.d/php-fpm

添加服务

[root@localhost sbin]# chkconfig --add php-fpm
服务 php-fpm 不支持 chkconfi

配置nginx支持php

配置文件位置 /usr/etc/nginx1910/conf/nginx.conf  

vi nginx.conf

添加index.php支持

  

添加fastCGI 支持 php-fpm 去掉#号,修改端口号

 

记得用./nginx -t命令看下配置文件是否正确

以下测试成功就是没问题 路径/usr/etc/nginx1910/sbin/nginx

[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/etc/nginx1910/conf/nginx.conf syntax is ok
nginx: configuration file /usr/etc/nginx1910/conf/nginx.conf test is successful

重启nginx  (路径 /usr/etc/nginx1910/sbin)

[root@localhost sbin]# ./nginx -s reload

停止nginx  

./nginx -s stop

启动nginx

./nginx

测试index.php  新建文件vi index.php(目录/usr/etc/nginx1910/html) 按I输入 <?php phpinfo();?>

测试成功 192.168.1.103/index.php

  

 

到此 还没有完成 自启动php-fpm, 

参考自己以前的文章

centos 7.0 编译安装php 5.6.7

http://www.cnblogs.com/xxx91hx/p/4410188.html

 

原文地址:https://www.cnblogs.com/xxx91hx/p/5185637.html