11.10/11.11/11.12 安裝PHP5
PHP5:咱們安裝5.6的版本php
一、下載源碼包:進入src目錄去下載html
[root@lgs-02 ~]# cd /usr/local/src/ [root@lgs-02 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz [root@lgs-02 src]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2 --2018-05-25 23:03:53-- http://cn2.php.net/distributions/php-5.6.32.tar.bz2 正在解析主機 cn2.php.net (cn2.php.net)... 36.51.255.144 正在鏈接 cn2.php.net (cn2.php.net)|36.51.255.144|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:15055569 (14M) [application/octet-stream] 正在保存至: 「php-5.6.32.tar.bz2」 100%[===========================================================================================================================>] 15,055,569 675KB/s 用時 26s 2018-05-25 23:04:24 (559 KB/s) - 已保存 「php-5.6.32.tar.bz2」 [15055569/15055569]) [root@lgs-02 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz php-5.6.32.tar.bz2 apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
二、解壓源碼包:python
[root@lgs-02 src]# tar xjvf php-5.6.32.tar.bz2 #省略過程 php-5.6.32/win32/testsuite.dsp php-5.6.32/win32/php5ts.dsw php-5.6.32/Makefile.global php-5.6.32/UPGRADING.INTERNALS php-5.6.32/php5.spec.in php-5.6.32/NEWS php-5.6.32/server-tests.php php-5.6.32/php.ini-development php-5.6.32/EXTENSIONS php-5.6.32/README.namespaces php-5.6.32/pear/ php-5.6.32/pear/install-pear.txt php-5.6.32/pear/install-pear-nozlib.phar php-5.6.32/pear/fetch.php php-5.6.32/pear/Makefile.frag php-5.6.32/README.SUBMITTING_PATCH [root@lgs-02 src]# cd php-5.6.32 [root@lgs-02 php-5.6.32]# ls acinclude.m4 CREDITS ltmain.sh NEWS README.md README.TESTING2 stub.c aclocal.m4 ext main pear README.namespaces README.UNIX-BUILD-SYSTEM tests build EXTENSIONS makedist php5.spec.in README.NEW-OUTPUT-API README.WIN32-BUILD-SYSTEM travis buildconf footer Makefile.frag php.gif README.PARAMETER_PARSING_API run-tests.php TSRM buildconf.bat generated_lists Makefile.gcov php.ini-development README.REDIST.BINS sapi UPGRADING CODING_STANDARDS genfiles Makefile.global php.ini-production README.RELEASE_PROCESS scripts UPGRADING.INTERNALS config.guess header makerpm README.EXT_SKEL README.SELF-CONTAINED-EXTENSIONS server-tests-config.php vcsclean config.sub INSTALL missing README.GIT-RULES README.STREAMS server-tests.php win32 configure install-sh mkinstalldirs README.input_filter README.SUBMITTING_PATCH snapshot Zend configure.in LICENSE netware README.MAILINGLIST_RULES README.TESTING stamp-h.in
三、配置源碼包編譯選項,生成編譯文件:php也支持動態擴展模塊,編譯好後也能加入其餘擴展模塊mysql
[root@lgs-02 php-5.6.32]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/ -with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif 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... lib 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: 3.0). 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... no checking whether to force non-PIC code in shared modules... no checking whether /dev/urandom exists... yes checking for pthreads_cflags... -pthread checking for pthreads_lib... Configuring SAPI modules checking for AOLserver support... no checking for Apache 1.x module support via DSO through APXS... no checking for Apache 1.x module support... no checking whether to enable Apache charset compatibility option... no checking for Apache 2.0 filter-module support via DSO through APXS... no checking for Apache 2.0 handler-module support via DSO through APXS... yes checking for Apache 1.x (hooks) module support via DSO through APXS... no checking for Apache 1.x (hooks) module support... no checking whether to enable Apache charset compatibility option... no checking for Caudium support... 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 Continuity support... no checking for embedded SAPI library support... no checking for FPM build... no checking for Zeus ISAPI support... no checking for LiteSpeed support... no checking for Milter support... no checking for NSAPI support... no checking for phpdbg support... no checking for phpdbg debug build... no checking for PHTTPD support... no checking for Pi3Web support... no checking whether Roxen module is build using ZTS... no checking for Roxen/Pike support... checking for thttpd... no checking for TUX... no checking for webjames... no 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... apache2handler checking for executable SAPI binaries... cli 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... yes checking for netinet/in.h... yes checking for alloca.h... yes checking for arpa/inet.h... 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... 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... 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... yes checking for sys/socket.h... 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 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... 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/local/php/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 which regex library to use... php checking whether to enable LIBXML support... yes checking libxml2 install dir... yes checking for xml2-config path... /usr/bin/xml2-config checking whether libxml build works... yes checking for OpenSSL support... yes checking for Kerberos support... no checking whether to use system default cipher list instead of hardcoded value... no checking for DSA_get_default_method in -lssl... no checking for X509_free in -lcrypto... no checking for RAND_egd... no checking for pkg-config... /usr/bin/pkg-config configure: error: Cannot find OpenSSL's <evp.h>
報錯:缺乏OpenSSL's,安裝他,通常都是安裝.devel或者.lib文件名的包linux
[root@lgs-02 php-5.6.32]# yum list |grep -i openssl openssl.x86_64 1:1.0.2k-8.el7 @anaconda openssl-libs.x86_64 1:1.0.2k-8.el7 @anaconda xmlsec1-openssl.x86_64 1.2.20-5.el7 @anaconda apr-util-openssl.x86_64 1.5.2-6.el7 base openssl.x86_64 1:1.0.2k-12.el7 base openssl-devel.i686 1:1.0.2k-12.el7 base openssl-devel.x86_64 1:1.0.2k-12.el7 base openssl-libs.i686 1:1.0.2k-12.el7 base openssl-libs.x86_64 1:1.0.2k-12.el7 base openssl-perl.x86_64 1:1.0.2k-12.el7 base openssl-static.i686 1:1.0.2k-12.el7 base openssl-static.x86_64 1:1.0.2k-12.el7 base openssl098e.i686 0.9.8e-29.el7.centos.3 base openssl098e.x86_64 0.9.8e-29.el7.centos.3 base perl-Crypt-OpenSSL-Bignum.x86_64 0.04-18.el7 base perl-Crypt-OpenSSL-RSA.x86_64 0.28-7.el7 base perl-Crypt-OpenSSL-Random.x86_64 0.04-21.el7 base pyOpenSSL.x86_64 0.13.1-3.el7 base pyOpenSSL-doc.noarch 0.13.1-3.el7 base xmlsec1-openssl.i686 1.2.20-7.el7_4 base xmlsec1-openssl.x86_64 1.2.20-7.el7_4 base xmlsec1-openssl-devel.i686 1.2.20-7.el7_4 base xmlsec1-openssl-devel.x86_64 1.2.20-7.el7_4 base [root@lgs-02 php-5.6.32]# yum install -y openssl-devel 已加載插件:fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 updates/7/x86_64/primary_db | 2.0 MB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 openssl-devel.x86_64.1.1.0.2k-12.el7 將被 安裝 --> 正在處理依賴關係 openssl-libs(x86-64) = 1:1.0.2k-12.el7,它被軟件包 1:openssl-devel-1.0.2k-12.el7.x86_64 須要 --> 正在處理依賴關係 krb5-devel(x86-64),它被軟件包 1:openssl-devel-1.0.2k-12.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 krb5-devel.x86_64.0.1.15.1-19.el7 將被 安裝 --> 正在處理依賴關係 libkadm5(x86-64) = 1.15.1-19.el7,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 --> 正在處理依賴關係 krb5-libs(x86-64) = 1.15.1-19.el7,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 --> 正在處理依賴關係 libverto-devel,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 --> 正在處理依賴關係 libselinux-devel,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 --> 正在處理依賴關係 libcom_err-devel,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 --> 正在處理依賴關係 keyutils-libs-devel,它被軟件包 krb5-devel-1.15.1-19.el7.x86_64 須要 ---> 軟件包 openssl-libs.x86_64.1.1.0.2k-8.el7 將被 升級 --> 正在處理依賴關係 openssl-libs(x86-64) = 1:1.0.2k-8.el7,它被軟件包 1:openssl-1.0.2k-8.el7.x86_64 須要 ---> 軟件包 openssl-libs.x86_64.1.1.0.2k-12.el7 將被 更新 --> 正在檢查事務 ---> 軟件包 keyutils-libs-devel.x86_64.0.1.5.8-3.el7 將被 安裝 ---> 軟件包 krb5-libs.x86_64.0.1.15.1-8.el7 將被 升級 ---> 軟件包 krb5-libs.x86_64.0.1.15.1-19.el7 將被 更新 ---> 軟件包 libcom_err-devel.x86_64.0.1.42.9-12.el7_5 將被 安裝 --> 正在處理依賴關係 libcom_err(x86-64) = 1.42.9-12.el7_5,它被軟件包 libcom_err-devel-1.42.9-12.el7_5.x86_64 須要 ---> 軟件包 libkadm5.x86_64.0.1.15.1-19.el7 將被 安裝 ---> 軟件包 libselinux-devel.x86_64.0.2.5-12.el7 將被 安裝 --> 正在處理依賴關係 libselinux(x86-64) = 2.5-12.el7,它被軟件包 libselinux-devel-2.5-12.el7.x86_64 須要 --> 正在處理依賴關係 libsepol-devel(x86-64) >= 2.5-6,它被軟件包 libselinux-devel-2.5-12.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(libsepol),它被軟件包 libselinux-devel-2.5-12.el7.x86_64 須要 ---> 軟件包 libverto-devel.x86_64.0.0.2.5-4.el7 將被 安裝 ---> 軟件包 openssl.x86_64.1.1.0.2k-8.el7 將被 升級 ---> 軟件包 openssl.x86_64.1.1.0.2k-12.el7 將被 更新 --> 正在檢查事務 ---> 軟件包 libcom_err.x86_64.0.1.42.9-10.el7 將被 升級 --> 正在處理依賴關係 libcom_err(x86-64) = 1.42.9-10.el7,它被軟件包 e2fsprogs-1.42.9-10.el7.x86_64 須要 --> 正在處理依賴關係 libcom_err(x86-64) = 1.42.9-10.el7,它被軟件包 libss-1.42.9-10.el7.x86_64 須要 --> 正在處理依賴關係 libcom_err(x86-64) = 1.42.9-10.el7,它被軟件包 e2fsprogs-libs-1.42.9-10.el7.x86_64 須要 ---> 軟件包 libcom_err.x86_64.0.1.42.9-12.el7_5 將被 更新 ---> 軟件包 libselinux.x86_64.0.2.5-11.el7 將被 升級 --> 正在處理依賴關係 libselinux(x86-64) = 2.5-11.el7,它被軟件包 libselinux-utils-2.5-11.el7.x86_64 須要 --> 正在處理依賴關係 libselinux(x86-64) = 2.5-11.el7,它被軟件包 libselinux-python-2.5-11.el7.x86_64 須要 ---> 軟件包 libselinux.x86_64.0.2.5-12.el7 將被 更新 ---> 軟件包 libsepol-devel.x86_64.0.2.5-8.1.el7 將被 安裝 --> 正在處理依賴關係 libsepol(x86-64) = 2.5-8.1.el7,它被軟件包 libsepol-devel-2.5-8.1.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 e2fsprogs.x86_64.0.1.42.9-10.el7 將被 升級 ---> 軟件包 e2fsprogs.x86_64.0.1.42.9-12.el7_5 將被 更新 ---> 軟件包 e2fsprogs-libs.x86_64.0.1.42.9-10.el7 將被 升級 ---> 軟件包 e2fsprogs-libs.x86_64.0.1.42.9-12.el7_5 將被 更新 ---> 軟件包 libselinux-python.x86_64.0.2.5-11.el7 將被 升級 ---> 軟件包 libselinux-python.x86_64.0.2.5-12.el7 將被 更新 ---> 軟件包 libselinux-utils.x86_64.0.2.5-11.el7 將被 升級 ---> 軟件包 libselinux-utils.x86_64.0.2.5-12.el7 將被 更新 ---> 軟件包 libsepol.x86_64.0.2.5-6.el7 將被 升級 ---> 軟件包 libsepol.x86_64.0.2.5-8.1.el7 將被 更新 ---> 軟件包 libss.x86_64.0.1.42.9-10.el7 將被 升級 ---> 軟件包 libss.x86_64.0.1.42.9-12.el7_5 將被 更新 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: openssl-devel x86_64 1:1.0.2k-12.el7 base 1.5 M 爲依賴而安裝: keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k krb5-devel x86_64 1.15.1-19.el7 updates 269 k libcom_err-devel x86_64 1.42.9-12.el7_5 updates 31 k libkadm5 x86_64 1.15.1-19.el7 updates 175 k libselinux-devel x86_64 2.5-12.el7 base 186 k libsepol-devel x86_64 2.5-8.1.el7 base 77 k libverto-devel x86_64 0.2.5-4.el7 base 12 k 爲依賴而更新: e2fsprogs x86_64 1.42.9-12.el7_5 updates 699 k e2fsprogs-libs x86_64 1.42.9-12.el7_5 updates 167 k krb5-libs x86_64 1.15.1-19.el7 updates 747 k libcom_err x86_64 1.42.9-12.el7_5 updates 41 k libselinux x86_64 2.5-12.el7 base 162 k libselinux-python x86_64 2.5-12.el7 base 235 k libselinux-utils x86_64 2.5-12.el7 base 151 k libsepol x86_64 2.5-8.1.el7 base 297 k libss x86_64 1.42.9-12.el7_5 updates 45 k openssl x86_64 1:1.0.2k-12.el7 base 492 k openssl-libs x86_64 1:1.0.2k-12.el7 base 1.2 M 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 (+ 7 依賴軟件包) 升級 ( 11 依賴軟件包) 總下載量:6.4 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/19): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:00 (2/19): krb5-devel-1.15.1-19.el7.x86_64.rpm | 269 kB 00:00:00 (3/19): e2fsprogs-1.42.9-12.el7_5.x86_64.rpm | 699 kB 00:00:00 (4/19): e2fsprogs-libs-1.42.9-12.el7_5.x86_64.rpm | 167 kB 00:00:00 (5/19): libcom_err-devel-1.42.9-12.el7_5.x86_64.rpm | 31 kB 00:00:00 (6/19): libcom_err-1.42.9-12.el7_5.x86_64.rpm | 41 kB 00:00:00 (7/19): libselinux-2.5-12.el7.x86_64.rpm | 162 kB 00:00:00 (8/19): libselinux-devel-2.5-12.el7.x86_64.rpm | 186 kB 00:00:00 (9/19): libselinux-utils-2.5-12.el7.x86_64.rpm | 151 kB 00:00:00 (10/19): libsepol-2.5-8.1.el7.x86_64.rpm | 297 kB 00:00:00 (11/19): libkadm5-1.15.1-19.el7.x86_64.rpm | 175 kB 00:00:00 (12/19): libsepol-devel-2.5-8.1.el7.x86_64.rpm | 77 kB 00:00:00 (13/19): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00 (14/19): krb5-libs-1.15.1-19.el7.x86_64.rpm | 747 kB 00:00:01 (15/19): libselinux-python-2.5-12.el7.x86_64.rpm | 235 kB 00:00:00 (16/19): libss-1.42.9-12.el7_5.x86_64.rpm | 45 kB 00:00:00 (17/19): openssl-1.0.2k-12.el7.x86_64.rpm | 492 kB 00:00:00 (18/19): openssl-devel-1.0.2k-12.el7.x86_64.rpm | 1.5 MB 00:00:00 (19/19): openssl-libs-1.0.2k-12.el7.x86_64.rpm | 1.2 MB 00:00:01 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 1.9 MB/s | 6.4 MB 00:00:03 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : libcom_err-1.42.9-12.el7_5.x86_64 1/30 正在更新 : libsepol-2.5-8.1.el7.x86_64 2/30 正在更新 : libselinux-2.5-12.el7.x86_64 3/30 正在更新 : krb5-libs-1.15.1-19.el7.x86_64 4/30 正在更新 : 1:openssl-libs-1.0.2k-12.el7.x86_64 5/30 正在安裝 : libkadm5-1.15.1-19.el7.x86_64 6/30 正在安裝 : libsepol-devel-2.5-8.1.el7.x86_64 7/30 正在安裝 : libselinux-devel-2.5-12.el7.x86_64 8/30 正在更新 : libss-1.42.9-12.el7_5.x86_64 9/30 正在安裝 : libcom_err-devel-1.42.9-12.el7_5.x86_64 10/30 正在更新 : e2fsprogs-libs-1.42.9-12.el7_5.x86_64 11/30 正在安裝 : libverto-devel-0.2.5-4.el7.x86_64 12/30 正在安裝 : keyutils-libs-devel-1.5.8-3.el7.x86_64 13/30 正在安裝 : krb5-devel-1.15.1-19.el7.x86_64 14/30 正在安裝 : 1:openssl-devel-1.0.2k-12.el7.x86_64 15/30 正在更新 : e2fsprogs-1.42.9-12.el7_5.x86_64 16/30 正在更新 : 1:openssl-1.0.2k-12.el7.x86_64 17/30 正在更新 : libselinux-python-2.5-12.el7.x86_64 18/30 正在更新 : libselinux-utils-2.5-12.el7.x86_64 19/30 清理 : 1:openssl-1.0.2k-8.el7.x86_64 20/30 清理 : e2fsprogs-1.42.9-10.el7.x86_64 21/30 清理 : krb5-libs-1.15.1-8.el7.x86_64 22/30 清理 : 1:openssl-libs-1.0.2k-8.el7.x86_64 23/30 清理 : libselinux-utils-2.5-11.el7.x86_64 24/30 清理 : e2fsprogs-libs-1.42.9-10.el7.x86_64 25/30 清理 : libss-1.42.9-10.el7.x86_64 26/30 清理 : libselinux-python-2.5-11.el7.x86_64 27/30 清理 : libselinux-2.5-11.el7.x86_64 28/30 清理 : libsepol-2.5-6.el7.x86_64 29/30 清理 : libcom_err-1.42.9-10.el7.x86_64 30/30 驗證中 : krb5-devel-1.15.1-19.el7.x86_64 1/30 驗證中 : keyutils-libs-devel-1.5.8-3.el7.x86_64 2/30 驗證中 : 1:openssl-libs-1.0.2k-12.el7.x86_64 3/30 驗證中 : libselinux-python-2.5-12.el7.x86_64 4/30 驗證中 : 1:openssl-devel-1.0.2k-12.el7.x86_64 5/30 驗證中 : libverto-devel-0.2.5-4.el7.x86_64 6/30 驗證中 : libselinux-devel-2.5-12.el7.x86_64 7/30 驗證中 : libss-1.42.9-12.el7_5.x86_64 8/30 驗證中 : libcom_err-devel-1.42.9-12.el7_5.x86_64 9/30 驗證中 : e2fsprogs-1.42.9-12.el7_5.x86_64 10/30 驗證中 : e2fsprogs-libs-1.42.9-12.el7_5.x86_64 11/30 驗證中 : libsepol-devel-2.5-8.1.el7.x86_64 12/30 驗證中 : krb5-libs-1.15.1-19.el7.x86_64 13/30 驗證中 : libsepol-2.5-8.1.el7.x86_64 14/30 驗證中 : libcom_err-1.42.9-12.el7_5.x86_64 15/30 驗證中 : libselinux-2.5-12.el7.x86_64 16/30 驗證中 : libselinux-utils-2.5-12.el7.x86_64 17/30 驗證中 : libkadm5-1.15.1-19.el7.x86_64 18/30 驗證中 : 1:openssl-1.0.2k-12.el7.x86_64 19/30 驗證中 : libss-1.42.9-10.el7.x86_64 20/30 驗證中 : libselinux-utils-2.5-11.el7.x86_64 21/30 驗證中 : libselinux-2.5-11.el7.x86_64 22/30 驗證中 : libselinux-python-2.5-11.el7.x86_64 23/30 驗證中 : 1:openssl-1.0.2k-8.el7.x86_64 24/30 驗證中 : 1:openssl-libs-1.0.2k-8.el7.x86_64 25/30 驗證中 : libsepol-2.5-6.el7.x86_64 26/30 驗證中 : libcom_err-1.42.9-10.el7.x86_64 27/30 驗證中 : e2fsprogs-libs-1.42.9-10.el7.x86_64 28/30 驗證中 : e2fsprogs-1.42.9-10.el7.x86_64 29/30 驗證中 : krb5-libs-1.15.1-8.el7.x86_64 30/30 已安裝: openssl-devel.x86_64 1:1.0.2k-12.el7 做爲依賴被安裝: keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-19.el7 libcom_err-devel.x86_64 0:1.42.9-12.el7_5 libkadm5.x86_64 0:1.15.1-19.el7 libselinux-devel.x86_64 0:2.5-12.el7 libsepol-devel.x86_64 0:2.5-8.1.el7 libverto-devel.x86_64 0:0.2.5-4.el7 做爲依賴被升級: e2fsprogs.x86_64 0:1.42.9-12.el7_5 e2fsprogs-libs.x86_64 0:1.42.9-12.el7_5 krb5-libs.x86_64 0:1.15.1-19.el7 libcom_err.x86_64 0:1.42.9-12.el7_5 libselinux.x86_64 0:2.5-12.el7 libselinux-python.x86_64 0:2.5-12.el7 libselinux-utils.x86_64 0:2.5-12.el7 libsepol.x86_64 0:2.5-8.1.el7 libss.x86_64 0:1.42.9-12.el7_5 openssl.x86_64 1:1.0.2k-12.el7 openssl-libs.x86_64 1:1.0.2k-12.el7 完畢!
繼續配置php源碼包編譯文件:ios
[root@lgs-02 php-5.6.32]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/ -with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif checking for gzgets in -lz... yes checking whether to enable bc style precision math functions... no checking for BZip2 support... yes checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution
又報錯:缺乏BZip2,安裝他:web
[root@lgs-02 php-5.6.32]# yum list|grep -i bzip2 bzip2.x86_64 1.0.6-13.el7 @base bzip2-libs.x86_64 1.0.6-13.el7 @anaconda bzip2-devel.i686 1.0.6-13.el7 base bzip2-devel.x86_64 1.0.6-13.el7 base bzip2-libs.i686 1.0.6-13.el7 base perl-Compress-Raw-Bzip2.x86_64 2.061-3.el7 base [root@lgs-02 php-5.6.32]# yum install -y bzip2-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 bzip2-devel.x86_64.0.1.0.6-13.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: bzip2-devel x86_64 1.0.6-13.el7 base 218 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 總下載量:218 k 安裝大小:382 k Downloading packages: bzip2-devel-1.0.6-13.el7.x86_64.rpm | 218 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : bzip2-devel-1.0.6-13.el7.x86_64 1/1 驗證中 : bzip2-devel-1.0.6-13.el7.x86_64 1/1 已安裝: bzip2-devel.x86_64 0:1.0.6-13.el7 完畢!
再繼續配置php源碼包編譯文件:sql
checking for T1lib support... no checking whether to enable truetype string function in GD... yes checking whether to enable JIS-mapped Japanese font support in GD... no If configure fails try --with-vpx-dir=<DIR> configure: error: jpeglib.h not found.
又報錯:缺乏jpeglib,安裝他:express
[root@lgs-02 php-5.6.32]# yum list|grep -i jpeg libjpeg-turbo.i686 1.2.90-5.el7 base libjpeg-turbo.x86_64 1.2.90-5.el7 base libjpeg-turbo-devel.i686 1.2.90-5.el7 base libjpeg-turbo-devel.x86_64 1.2.90-5.el7 base libjpeg-turbo-static.i686 1.2.90-5.el7 base libjpeg-turbo-static.x86_64 1.2.90-5.el7 base libjpeg-turbo-utils.x86_64 1.2.90-5.el7 base openjpeg.x86_64 1.5.1-17.el7 base openjpeg-devel.i686 1.5.1-17.el7 base openjpeg-devel.x86_64 1.5.1-17.el7 base openjpeg-libs.i686 1.5.1-17.el7 base openjpeg-libs.x86_64 1.5.1-17.el7 base turbojpeg.i686 1.2.90-5.el7 base turbojpeg.x86_64 1.2.90-5.el7 base turbojpeg-devel.i686 1.2.90-5.el7 base turbojpeg-devel.x86_64 1.2.90-5.el7 base [root@lgs-02 php-5.6.32]# yum install -y libjpeg-turbo-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 libjpeg-turbo-devel.x86_64.0.1.2.90-5.el7 將被 安裝 --> 正在處理依賴關係 libjpeg-turbo(x86-64) = 1.2.90-5.el7,它被軟件包 libjpeg-turbo-devel-1.2.90-5.el7.x86_64 須要 --> 正在處理依賴關係 libjpeg.so.62()(64bit),它被軟件包 libjpeg-turbo-devel-1.2.90-5.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 libjpeg-turbo.x86_64.0.1.2.90-5.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: libjpeg-turbo-devel x86_64 1.2.90-5.el7 base 98 k 爲依賴而安裝: libjpeg-turbo x86_64 1.2.90-5.el7 base 134 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 (+1 依賴軟件包) 總下載量:232 k 安裝大小:656 k Downloading packages: (1/2): libjpeg-turbo-1.2.90-5.el7.x86_64.rpm | 134 kB 00:00:00 (2/2): libjpeg-turbo-devel-1.2.90-5.el7.x86_64.rpm | 98 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 415 kB/s | 232 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : libjpeg-turbo-1.2.90-5.el7.x86_64 1/2 正在安裝 : libjpeg-turbo-devel-1.2.90-5.el7.x86_64 2/2 驗證中 : libjpeg-turbo-1.2.90-5.el7.x86_64 1/2 驗證中 : libjpeg-turbo-devel-1.2.90-5.el7.x86_64 2/2 已安裝: libjpeg-turbo-devel.x86_64 0:1.2.90-5.el7 做爲依賴被安裝: libjpeg-turbo.x86_64 0:1.2.90-5.el7 完畢!
再再繼續配置php源碼包編譯文件:apache
checking whether to enable JIS-mapped Japanese font support in GD... no If configure fails try --with-vpx-dir=<DIR> checking for jpeg_read_header in -ljpeg... yes configure: error: png.h not found.
又報錯:缺乏png,安裝他。
[root@lgs-02 php-5.6.32]# yum list|grep png libpng.i686 2:1.5.13-7.el7_2 base libpng.x86_64 2:1.5.13-7.el7_2 base libpng-devel.i686 2:1.5.13-7.el7_2 base libpng-devel.x86_64 2:1.5.13-7.el7_2 base libpng-static.i686 2:1.5.13-7.el7_2 base libpng-static.x86_64 2:1.5.13-7.el7_2 base libpng12.i686 1.2.50-10.el7 base libpng12.x86_64 1.2.50-10.el7 base libpng12-devel.i686 1.2.50-10.el7 base libpng12-devel.x86_64 1.2.50-10.el7 base optipng.x86_64 0.7.4-4.el7 base pngcrush.x86_64 1.7.59-4.el7 base pngnq.x86_64 1.1-9.el7 base texlive-dvipng.noarch 2:svn26689.1.14-38.el7 base texlive-dvipng-bin.x86_64 2:svn26509.0-38.20130427_r30134.el7 texlive-dvipng-doc.noarch 2:svn26689.1.14-38.el7 base [root@lgs-02 php-5.6.32]# yum install -y libpng-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 libpng-devel.x86_64.2.1.5.13-7.el7_2 將被 安裝 --> 正在處理依賴關係 libpng(x86-64) = 2:1.5.13-7.el7_2,它被軟件包 2:libpng-devel-1.5.13-7.el7_2.x86_64 須要 --> 正在處理依賴關係 libpng15.so.15()(64bit),它被軟件包 2:libpng-devel-1.5.13-7.el7_2.x86_64 須要 --> 正在檢查事務 ---> 軟件包 libpng.x86_64.2.1.5.13-7.el7_2 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: libpng-devel x86_64 2:1.5.13-7.el7_2 base 122 k 爲依賴而安裝: libpng x86_64 2:1.5.13-7.el7_2 base 213 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 (+1 依賴軟件包) 總下載量:334 k 安裝大小:813 k Downloading packages: (1/2): libpng-devel-1.5.13-7.el7_2.x86_64.rpm | 122 kB 00:00:00 (2/2): libpng-1.5.13-7.el7_2.x86_64.rpm | 213 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 579 kB/s | 334 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : 2:libpng-1.5.13-7.el7_2.x86_64 1/2 正在安裝 : 2:libpng-devel-1.5.13-7.el7_2.x86_64 2/2 驗證中 : 2:libpng-devel-1.5.13-7.el7_2.x86_64 1/2 驗證中 : 2:libpng-1.5.13-7.el7_2.x86_64 2/2 已安裝: libpng-devel.x86_64 2:1.5.13-7.el7_2 做爲依賴被安裝: libpng.x86_64 2:1.5.13-7.el7_2 完畢!
再再再繼續配置編譯文件:
If configure fails try --with-vpx-dir=<DIR> checking for jpeg_read_header in -ljpeg... yes checking for png_write_image in -lpng... yes If configure fails try --with-xpm-dir=<DIR> configure: error: freetype-config not found.
又報錯:缺乏freetype,安裝他
[root@lgs-02 php-5.6.32]# yum list |grep freetype freetype.x86_64 2.4.11-15.el7 @anaconda freetype.i686 2.4.11-15.el7 base freetype-demos.x86_64 2.4.11-15.el7 base freetype-devel.i686 2.4.11-15.el7 base freetype-devel.x86_64 2.4.11-15.el7 base [root@lgs-02 php-5.6.32]# yum install -y freetype-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 freetype-devel.x86_64.0.2.4.11-15.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: freetype-devel x86_64 2.4.11-15.el7 base 356 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 總下載量:356 k 安裝大小:2.4 M Downloading packages: freetype-devel-2.4.11-15.el7.x86_64.rpm | 356 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : freetype-devel-2.4.11-15.el7.x86_64 1/1 驗證中 : freetype-devel-2.4.11-15.el7.x86_64 1/1 已安裝: freetype-devel.x86_64 0:2.4.11-15.el7 完畢!
再再再再繼續配置編譯文件:
checking for working memcmp... yes checking for stdarg.h... (cached) yes checking for mcrypt support... yes configure: error: mcrypt.h not found. Please reinstall libmcrypt.
又報錯:缺乏mcrypt,安裝他
[root@lgs-02 php-5.6.32]# yum list |grep mcrypt libtomcrypt.x86_64 1.17-26.el7 extras libtomcrypt-devel.x86_64 1.17-26.el7 extras libtomcrypt-doc.noarch 1.17-26.el7 extras [root@lgs-02 php-5.6.32]# yum install -y libtomcrypt-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 libtomcrypt-devel.x86_64.0.1.17-26.el7 將被 安裝 --> 正在處理依賴關係 libtomcrypt(x86-64) = 1.17-26.el7,它被軟件包 libtomcrypt-devel-1.17-26.el7.x86_64 須要 --> 正在處理依賴關係 libtomcrypt.so.0()(64bit),它被軟件包 libtomcrypt-devel-1.17-26.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 libtomcrypt.x86_64.0.1.17-26.el7 將被 安裝 --> 正在處理依賴關係 libtommath >= 0.42.0,它被軟件包 libtomcrypt-1.17-26.el7.x86_64 須要 --> 正在處理依賴關係 libtommath.so.0()(64bit),它被軟件包 libtomcrypt-1.17-26.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 libtommath.x86_64.0.0.42.0-6.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: libtomcrypt-devel x86_64 1.17-26.el7 extras 33 k 爲依賴而安裝: libtomcrypt x86_64 1.17-26.el7 extras 224 k libtommath x86_64 0.42.0-6.el7 extras 36 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 (+2 依賴軟件包) 總下載量:293 k 安裝大小:769 k Downloading packages: (1/3): libtomcrypt-1.17-26.el7.x86_64.rpm | 224 kB 00:00:00 (2/3): libtomcrypt-devel-1.17-26.el7.x86_64.rpm | 33 kB 00:00:00 (3/3): libtommath-0.42.0-6.el7.x86_64.rpm | 36 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 358 kB/s | 293 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : libtommath-0.42.0-6.el7.x86_64 1/3 正在安裝 : libtomcrypt-1.17-26.el7.x86_64 2/3 正在安裝 : libtomcrypt-devel-1.17-26.el7.x86_64 3/3 驗證中 : libtommath-0.42.0-6.el7.x86_64 1/3 驗證中 : libtomcrypt-devel-1.17-26.el7.x86_64 2/3 驗證中 : libtomcrypt-1.17-26.el7.x86_64 3/3 已安裝: libtomcrypt-devel.x86_64 0:1.17-26.el7 做爲依賴被安裝: libtomcrypt.x86_64 0:1.17-26.el7 libtommath.x86_64 0:0.42.0-6.el7 完畢!
再再再再再繼續配置編譯文件:
checking for stdarg.h... (cached) yes checking for mcrypt support... yes configure: error: mcrypt.h not found. Please reinstall libmcrypt.
又報錯:libmcrypt是在擴展源epel-release裏,因此先安裝epel擴展源,再安裝libmcrypt,而不是上面安裝libtomcrypt。
[root@lgs-02 php-5.6.32]# yum list |grep epel-release epel-release.noarch 7-11 extras [root@lgs-02 php-5.6.32]# yum install -y epel-release 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 epel-release.noarch.0.7-11 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: epel-release noarch 7-11 extras 15 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 總下載量:15 k 安裝大小:24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : epel-release-7-11.noarch 1/1 驗證中 : epel-release-7-11.noarch 1/1 已安裝: epel-release.noarch 0:7-11 完畢! [root@lgs-02 php-5.6.32]# yum list|grep libmcrypt libmcrypt.x86_64 2.5.8-13.el7 epel libmcrypt-devel.x86_64 2.5.8-13.el7 epel [root@lgs-02 php-5.6.32]# yum install -y libmcrypt-devel 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.sohu.com * extras: mirrors.163.com * updates: mirrors.163.com 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 libmcrypt-devel.x86_64.0.2.5.8-13.el7 將被 安裝 --> 正在處理依賴關係 libmcrypt = 2.5.8-13.el7,它被軟件包 libmcrypt-devel-2.5.8-13.el7.x86_64 須要 --> 正在處理依賴關係 libmcrypt.so.4()(64bit),它被軟件包 libmcrypt-devel-2.5.8-13.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 libmcrypt.x86_64.0.2.5.8-13.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ===================================================================================================================================================================== Package 架構 版本 源 大小 ===================================================================================================================================================================== 正在安裝: libmcrypt-devel x86_64 2.5.8-13.el7 epel 13 k 爲依賴而安裝: libmcrypt x86_64 2.5.8-13.el7 epel 99 k 事務概要 ===================================================================================================================================================================== 安裝 1 軟件包 (+1 依賴軟件包) 總下載量:112 k 安裝大小:302 k Downloading packages: 警告:/var/cache/yum/x86_64/7/epel/packages/libmcrypt-2.5.8-13.el7.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID 352c64e5: NOKEY ] 0.0 B/s | 83 kB --:--:-- ETA libmcrypt-2.5.8-13.el7.x86_64.rpm 的公鑰還沒有安裝 (1/2): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00:00 (2/2): libmcrypt-devel-2.5.8-13.el7.x86_64.rpm | 13 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計 150 kB/s | 112 kB 00:00:00 從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 檢索密鑰 導入 GPG key 0x352C64E5: 用戶ID : "Fedora EPEL (7) <epel@fedoraproject.org>" 指紋 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5 軟件包 : epel-release-7-11.noarch (@extras) 來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : libmcrypt-2.5.8-13.el7.x86_64 1/2 正在安裝 : libmcrypt-devel-2.5.8-13.el7.x86_64 2/2 驗證中 : libmcrypt-devel-2.5.8-13.el7.x86_64 1/2 驗證中 : libmcrypt-2.5.8-13.el7.x86_64 2/2 已安裝: libmcrypt-devel.x86_64 0:2.5.8-13.el7 做爲依賴被安裝: libmcrypt.x86_64 0:2.5.8-13.el7 完畢!
再再再再再繼續配置編譯文件:
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 php5.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/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 [root@lgs-02 php-5.6.32]# echo $? 0
四、配置好並生成編譯文件後,就進行編譯。
ext/xmlwriter/php_xmlwriter.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/output.lo main/getopt.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo main/streams/glob_wrapper.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_dtrace.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_vm_opcodes.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo -lcrypt -lresolv -lcrypt -lrt -lmysqlclient_r -lmcrypt -lltdl -lpng -lz -ljpeg -lbz2 -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -lxml2 -lz -lm -ldl -lfreetype -lmysqlclient -lm -lrt -ldl -lmysqlclient -lm -lrt -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -o sapi/cgi/php-cgi Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. clicommand.inc directorytreeiterator.inc invertedregexiterator.inc directorygraphiterator.inc pharcommand.inc phar.inc Build complete. Don't forget to run 'make test'. [root@lgs-02 php-5.6.32]# echo $? 0
五、安裝:make install
[root@lgs-02 php-5.6.32]# make install Installing PHP SAPI module: apache2handler /usr/local/apache2.4//build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp5.la /usr/local/apache2.4//modules /usr/local/apr/build-1/libtool --mode=install install libphp5.la /usr/local/apache2.4//modules/ libtool: install: install .libs/libphp5.so /usr/local/apache2.4//modules/libphp5.so libtool: install: install .libs/libphp5.lai /usr/local/apache2.4//modules/libphp5.la libtool: warning: remember to run 'libtool --finish /usr/local/src/php-5.6.32/libs' chmod 755 /usr/local/apache2.4//modules/libphp5.so [activating module `php5' in /usr/local/apache2.4//conf/httpd.conf] Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/ Installing PHP CLI binary: /usr/local/php/bin/ Installing PHP CLI man page: /usr/local/php/php/man/man1/ Installing PHP CGI binary: /usr/local/php/bin/ Installing PHP CGI man page: /usr/local/php/php/man/man1/ Installing build environment: /usr/local/php/lib/php/build/ Installing header files: /usr/local/php/include/php/ Installing helper programs: /usr/local/php/bin/ program: phpize program: php-config Installing man pages: /usr/local/php/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php/lib/php/ [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/php/etc/pear.conf You may want to add: /usr/local/php/lib/php to your php.ini include_path /usr/local/src/php-5.6.32/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin ln -s -f phar.phar /usr/local/php/bin/phar Installing PDO headers: /usr/local/php/include/php/ext/pdo/ [root@lgs-02 php-5.6.32]# echo $? 0
六、php5.6 安裝成功了,查看php目錄結構和做用
[root@lgs-02 local]# ls apache2.4 apr apr-util bin etc games include lib lib64 libexec mariadb mysql php sbin share src [root@lgs-02 local]# cd php [root@lgs-02 php]# ls bin etc include lib php
核心二進制文件是:
[root@lgs-02 php]# ls bin/php php php-cgi php-config phpize [root@lgs-02 php]# ls -l bin/php -rwxr-xr-x. 1 root root 36973632 5月 25 23:48 bin/php
七、在源碼包裏拷貝配置文件到安裝目錄下:有測試開發版本的配置文件,也有生產的配置文件,根據須要進行選擇
[root@lgs-02 php]# cp /usr/local/src/php-5.6.32/php php5.spec php5.spec.in php.gif php.ini-development php.ini-production [root@lgs-02 php]# cp /usr/local/src/php-5.6.32/php.ini-production /usr/local/php/etc/php.ini [root@lgs-02 php]# ls -l etc/php.ini -rw-r--r--. 1 root root 73685 5月 25 23:54 etc/php.ini
八、查看PHP模塊是否正確加載進Apache服務裏,是否在apache的modules目錄裏有libphp5.so文件:由於配置php編譯文件的時候,指定了apxs工具,他是自動把php加入並加載Apache的工具。
[root@lgs-02 php]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::870d:85e5:c861:a422. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) php5_module (shared) [root@lgs-02 php]# ls -l /usr/local/apache2.4/modules/libphp5.so -rwxr-xr-x. 1 root root 37743784 5月 25 23:48 /usr/local/apache2.4/modules/libphp5.so3
九、查看php加載的功能模塊:
[root@lgs-02 php]# /usr/local/php/bin/php -m [PHP Modules] bz2 Core ctype date dom ereg exif fileinfo filter gd hash iconv json libxml mbstring mcrypt mysql mysqli openssl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session SimpleXML soap sockets SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib
十、不用單獨啓動php,是在Apache服務配置文件裏啓用 加載 LoadModule php5_module modules/libphp5.so
[root@lgs-02 apache2.4]# vim conf/httpd.conf # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. # In particular, see # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non-local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used. If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/usr/local/apache2.4/" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_socache_module modules/mod_authn_socache.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_owner_module modules/mod_authz_owner.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_form_module modules/mod_auth_form.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule allowmethods_module modules/mod_allowmethods.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule macro_module modules/mod_macro.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule dumpio_module modules/mod_dumpio.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule ratelimit_module modules/mod_ratelimit.so LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule request_module modules/mod_request.so #LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule sed_module modules/mod_sed.so #LoadModule deflate_module modules/mod_deflate.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so #LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so #LoadModule cgid_module modules/mod_cgid.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so #LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module modules/libphp5.so
十一、查看php服務的詳細信息:
[root@lgs-02 apache2.4]# /usr/local/php/bin/php -i|less PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0 phpinfo() PHP Version => 5.6.32 System => Linux lgs-02 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 Build Date => May 25 2018 23:44:49 Configure Command => './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2.4/bin/apxs' '--with-config-file-path=/usr/local/php/etc' '--with-mysql=/usr/local/mysql' '--with-pdo-mysql=/usr/local/mysql/' '-with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-libxml-dir' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--with-iconv-dir' '--with-zlib-dir' '--with-bz2' '--with-openssl' '--with-mcrypt' '--enable-soap' '--enable-gd-native-ttf' '--enable-mbstring' '--enable-sockets' '--enable-exif' Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => /usr/local/php/etc Loaded Configuration File => /usr/local/php/etc/php.ini Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20131106 PHP Extension => 20131226 Zend Extension => 220131226 Zend Extension Build => API220131226,TS PHP Extension Build => API20131226,TS Debug Build => no Thread Safety => enabled Zend Signal Handling => disabled Zend Memory Manager => enabled Zend Multibyte Support => provided by mbstring IPv6 Support => enabled DTrace Support => disabled Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2 Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk This program makes use of the Zend Scripting Language Engine: Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies _______________________________________________________________________ Configuration bz2 BZip2 Support => Enabled Stream Wrapper support => compress.bzip2://
11.13 安裝PHP7
一、下載源碼包php-7:進入src目錄去下載
[root@lgs-02 src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2 [root@lgs-02 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz php-5.6.32 php-7.1.6 apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz php-5.6.32.tar.bz2 php-7.1.6.tar.bz2
二、解壓源碼包php-7:
[root@lgs-02 src]# tar xjvf php-7.1.6.tar.bz2 php-7.1.6/win32/build/wsyslog.mc php-7.1.6/win32/build/config.w32.h.in php-7.1.6/win32/build/configure.bat php-7.1.6/win32/build/deplister.c php-7.1.6/win32/winutil.c php-7.1.6/win32/ioutil.c php-7.1.6/win32/fnmatch.h php-7.1.6/win32/ftok.c php-7.1.6/win32/select.c [root@lgs-02 src]# ls php-7.1.6 acinclude.m4 CONTRIBUTING.md ltmain.sh pear README.NEW-OUTPUT-API run-tests.php UPGRADING aclocal.m4 CREDITS main php7.spec.in README.PARAMETER_PARSING_API sapi UPGRADING.INTERNALS appveyor ext makedist php.gif README.REDIST.BINS scripts vcsclean build EXTENSIONS Makefile.frag php.ini-development README.RELEASE_PROCESS server-tests-config.php win32 buildconf footer Makefile.gcov php.ini-production README.SELF-CONTAINED-EXTENSIONS server-tests.php Zend buildconf.bat generated_lists Makefile.global README.EXT_SKEL README.STREAMS snapshot CODING_STANDARDS genfiles makerpm README.GIT-RULES README.SUBMITTING_PATCH stamp-h.in config.guess header missing README.input_filter README.TESTING stub.c config.sub INSTALL mkinstalldirs README.MAILINGLIST_RULES README.TESTING2 tests configure install-sh netware README.md README.UNIX-BUILD-SYSTEM travis configure.in LICENSE NEWS README.namespaces README.WIN32-BUILD-SYSTEM TSRM
三、配置源碼包編譯選項,生成編譯文件
[root@lgs-02 src]# cd php-7.1.6 [root@lgs-02 php-7.1.6]# ls acinclude.m4 CONTRIBUTING.md ltmain.sh pear README.NEW-OUTPUT-API run-tests.php UPGRADING aclocal.m4 CREDITS main php7.spec.in README.PARAMETER_PARSING_API sapi UPGRADING.INTERNALS appveyor ext makedist php.gif README.REDIST.BINS scripts vcsclean build EXTENSIONS Makefile.frag php.ini-development README.RELEASE_PROCESS server-tests-config.php win32 buildconf footer Makefile.gcov php.ini-production README.SELF-CONTAINED-EXTENSIONS server-tests.php Zend buildconf.bat generated_lists Makefile.global README.EXT_SKEL README.STREAMS snapshot CODING_STANDARDS genfiles makerpm README.GIT-RULES README.SUBMITTING_PATCH stamp-h.in config.guess header missing README.input_filter README.TESTING stub.c config.sub INSTALL mkinstalldirs README.MAILINGLIST_RULES README.TESTING2 tests configure install-sh netware README.md README.UNIX-BUILD-SYSTEM travis configure.in LICENSE NEWS README.namespaces README.WIN32-BUILD-SYSTEM TSRM [root@lgs-02 php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql/ -with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif 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/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 [root@lgs-02 php-7.1.6]#
四、配置好並生成編譯文件後,就進行編譯。
[root@lgs-02 php-7.1.6]# make Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_execute.lo main/internal_functions_cli.lo main/fastcgi.lo sapi/cgi/cgi_main.lo -lcrypt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lpng -lz -ljpeg -lbz2 -lz -lrt -lm -ldl -lnsl -lpthread -lxml2 -lz -lm -ldl -lssl -lcrypto -lxml2 -lz -lm -ldl -lfreetype -lmysqlclient -lm -lrt -ldl -lmysqlclient -lm -lrt -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -o sapi/cgi/php-cgi Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. directorytreeiterator.inc directorygraphiterator.inc pharcommand.inc clicommand.inc invertedregexiterator.inc phar.inc Build complete. Don't forget to run 'make test'.
五、安裝:make install
[root@lgs-02 php-7.1.6]# make install Installing PHP SAPI module: apache2handler /usr/local/apache2.4//build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp7.la /usr/local/apache2.4//modules /usr/local/apr/build-1/libtool --mode=install install libphp7.la /usr/local/apache2.4//modules/ libtool: install: install .libs/libphp7.so /usr/local/apache2.4//modules/libphp7.so libtool: install: install .libs/libphp7.lai /usr/local/apache2.4//modules/libphp7.la libtool: warning: remember to run 'libtool --finish /usr/local/src/php-7.1.6/libs' chmod 755 /usr/local/apache2.4//modules/libphp7.so [activating module `php7' in /usr/local/apache2.4//conf/httpd.conf] Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/ Installing PHP CLI binary: /usr/local/php7/bin/ Installing PHP CLI man page: /usr/local/php7/php/man/man1/ Installing phpdbg binary: /usr/local/php7/bin/ Installing phpdbg man page: /usr/local/php7/php/man/man1/ Installing PHP CGI binary: /usr/local/php7/bin/ Installing PHP CGI man page: /usr/local/php7/php/man/man1/ Installing build environment: /usr/local/php7/lib/php/build/ Installing header files: /usr/local/php7/include/php/ Installing helper programs: /usr/local/php7/bin/ program: phpize program: php-config Installing man pages: /usr/local/php7/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php7/lib/php/ [PEAR] Archive_Tar - installed: 1.4.2 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.4 Wrote PEAR system config file at: /usr/local/php7/etc/pear.conf You may want to add: /usr/local/php7/lib/php to your php.ini include_path /usr/local/src/php-7.1.6/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin ln -s -f phar.phar /usr/local/php7/bin/phar Installing PDO headers: /usr/local/php7/include/php/ext/pdo/
六、php7 安裝成功了,查看php目錄結構和做用 核心二進制文件是:
[root@lgs-02 php-7.1.6]# cd /usr/local/php7 [root@lgs-02 php7]# ls bin etc include lib php var [root@lgs-02 php7]# ls bin/php php php-cgi php-config phpdbg phpize [root@lgs-02 php7]# ls -l bin/php -rwxr-xr-x. 1 root root 37637440 5月 26 00:30 bin/php
七、在源碼包裏拷貝配置文件到安裝目錄下:有測試開發版本的配置文件,也有生產的配置文件,根據須要進行選擇
[root@lgs-02 php7]# cp /usr/local/src/php-7.1.6/php.ini-production /usr/local/php7/etc/php.ini [root@lgs-02 php7]# ls etc/php.ini etc/php.ini
八、查看PHP模塊是否正確加載進Apache服務裏,是否在apache的modules目錄裏有libphp7.so文件:由於配置php編譯文件的時候,指定了apxs工具,他是自動把php加入並加載Apache的工具。
[root@lgs-02 php7]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::870d:85e5:c861:a422. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) php5_module (shared) php7_module (shared) [root@lgs-02 php7]# ls -l /usr/local/apache2.4/modules/libphp7.so -rwxr-xr-x. 1 root root 38369944 5月 26 00:30 /usr/local/apache2.4/modules/libphp7.so
九、查看php加載的功能模塊:
[root@lgs-02 php7]# /usr/local/php7/bin/php -m [PHP Modules] bz2 Core ctype date dom exif fileinfo filter gd hash iconv json libxml mbstring mcrypt mysqli openssl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session SimpleXML soap sockets SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules]
十、不用單獨啓動php,是在Apache服務配置文件裏啓用 加載 LoadModule php7_module modules/libphp7.so
[root@lgs-02 php7]# vim /usr/local/apache2.4/conf/httpd.conf #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so #LoadModule cgid_module modules/mod_cgid.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so #LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module modules/libphp5.so LoadModule php7_module modules/libphp7.so
十一、查看php服務的詳細信息:
[root@lgs-02 php7]# /usr/local/php7/bin/php -i |less phpinfo() PHP Version => 7.1.6 System => Linux lgs-02 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 Build Date => May 26 2018 00:25:52 Configure Command => './configure' '--prefix=/usr/local/php7' '--with-apxs2=/usr/local/apache2.4/bin/apxs' '--with-config-file-path=/usr/local/php7/etc' '--with-pdo-mysql=/usr/local/mysql/' '-with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-libxml-dir' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--with-iconv-dir' '--with-zlib-dir' '--with-bz2' '--with-openssl' '--with-mcrypt' '--enable-soap' '--enable-gd-native-ttf' '--enable-mbstring' '--enable-sockets' '--enable-exif' Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => /usr/local/php7/etc Loaded Configuration File => /usr/local/php7/etc/php.ini Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20160303 PHP Extension => 20160303 Zend Extension => 320160303 Zend Extension Build => API320160303,TS PHP Extension Build => API20160303,TS Debug Build => no Thread Safety => enabled Zend Signal Handling => enabled Zend Memory Manager => enabled Zend Multibyte Support => provided by mbstring IPv6 Support => enabled DTrace Support => disabled Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2 Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk This program makes use of the Zend Scripting Language Engine: Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies _______________________________________________________________________ Configuration bz2 BZip2 Support => Enabled Stream Wrapper support => compress.bzip2://