编译安装PHP-7.2.8

一 下载并软件包

wget http://124.205.69.169/files/A218000006E9730A/cn2.php.net/distributions/php-7.2.8.tar.gz
tar xf php-7.2.8.tar.gz
cd php-7.2.8

二 安装依赖程序

yum -y install pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel

安装 libsodium-1.0.16.tar.gz yum安装报错编译安装

下载地址:https://github.com/jedisct1/libsodium/releases

tar xf libsodium-1.0.16.tar.gz 
cd libsodium-1.0.16/
./configure
 make -j 2 && make install
 ldconfig

三 编译安装

部分编译注释 ===>>点击进入

[root@centos7 php-7.2.8]# ./configure --prefix=/usr/local/php-7.2.8 --with-config-file-path=/usr/local/php-7.2.8/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-gmp --with-snmp --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --with-curl  --with-sodium --with-gd --with-openssl --with-mhash --with-xmlrpc --with-xsl --with-gettext --enable-pcntl --enable-sockets --enable-zip --enable-soap --enable-fpm --enable-mysqlnd --enable-ftp --enable-intl --enable-xml --enable-bcmath --enable-shmop --enable-exif --enable-sysvsem --enable-mbregex --enable-mbstring --enable-maintainer-zts --enable-inline-optimization --disable-debug --disable-rpath --disable-opcache --disable-fileinfo
[root@centos7 php-7.2.8]# echo $?
0
[root@centos7 php-7.2.8]# make -j 2
[root@centos7 php-7.2.8]# echo $?
0
[root@centos7 php-7.2.8]# make install
[root@centos7 php-7.2.8]# echo $?
0

在编译PHP过程中,编译php时,如果指定以下几个参数
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
表示使用mysqlnd驱动。

 

四 拷贝默认php配置文件

[root@centos7 php-7.2.8]# cp php.ini-development /usr/local/php-7.2.8/etc/php.ini
[root@centos7 php-7.2.8]# cp /usr/local/php-7.2.8/etc/php-fpm.conf.default /usr/local/php-7.2.8/etc/php-fpm.conf
[root@centos7 php-7.2.8]# cp /usr/local/php-7.2.8/etc/php-fpm.d/www.conf.default /usr/local/php-7.2.8/etc/php-fpm.d/www.conf

五 查看目录

[root@centos7 php-7.2.8]# cd /usr/local/php-7.2.8/
[root@centos7 php-7.2.8]# tree 
.
├── bin
│   ├── pear
│   ├── peardev
│   ├── pecl
│   ├── phar -> phar.phar
│   ├── phar.phar
│   ├── php
│   ├── php-cgi
│   ├── php-config
│   ├── phpdbg
│   └── phpize
├── etc
│   ├── pear.conf
│   ├── php-fpm.conf
│   ├── php-fpm.conf.default
│   ├── php-fpm.d
│   │   ├── www.conf
│   │   └── www.conf.default
│   └── php.ini
├── include
│   └── php
│       ├── ext
│       │   ├── date
│       │   │   ├── lib
│       │   │   │   ├── timelib_config.h
│       │   │   │   └── timelib.h
│       │   │   └── php_date.h
│       │   ├── dom
│       │   │   └── xml_common.h
│       │   ├── filter
│       │   │   └── php_filter.h
│       │   ├── gd
│       │   │   ├── gdcache.h
│       │   │   ├── gd_compat.h
│       │   │   ├── libgd
│       │   │   │   ├── bmp.h
│       │   │   │   ├── gdcache.h
│       │   │   │   ├── gd_errors.h
│       │   │   │   ├── gdfontg.h
│       │   │   │   ├── gdfontl.h
│       │   │   │   ├── gdfontmb.h
│       │   │   │   ├── gdfonts.h
│       │   │   │   ├── gdfontt.h
│       │   │   │   ├── gd.h
│       │   │   │   ├── gdhelpers.h
│       │   │   │   ├── gd_intern.h
│       │   │   │   ├── gd_io.h
│       │   │   │   ├── jisx0208.h
│       │   │   │   └── wbmp.h
│       │   │   └── php_gd.h
│       │   ├── hash
│       │   │   ├── php_hash_adler32.h
│       │   │   ├── php_hash_crc32.h
│       │   │   ├── php_hash_fnv.h
│       │   │   ├── php_hash_gost.h
│       │   │   ├── php_hash.h
│       │   │   ├── php_hash_haval.h
│       │   │   ├── php_hash_joaat.h
│       │   │   ├── php_hash_md.h
│       │   │   ├── php_hash_ripemd.h
│       │   │   ├── php_hash_sha3.h
│       │   │   ├── php_hash_sha.h
│       │   │   ├── php_hash_snefru.h
│       │   │   ├── php_hash_tiger.h
│       │   │   └── php_hash_whirlpool.h
│       │   ├── iconv
│       │   │   ├── php_have_bsd_iconv.h
│       │   │   ├── php_have_glibc_iconv.h
│       │   │   ├── php_have_ibm_iconv.h
│       │   │   ├── php_have_iconv.h
│       │   │   ├── php_have_libiconv.h
│       │   │   ├── php_iconv_aliased_libiconv.h
│       │   │   ├── php_iconv_broken_ignore.h
│       │   │   ├── php_iconv.h
│       │   │   ├── php_iconv_supports_errno.h
│       │   │   ├── php_php_iconv_h_path.h
│       │   │   └── php_php_iconv_impl.h
│       │   ├── json
│       │   │   ├── php_json.h
│       │   │   ├── php_json_parser.h
│       │   │   └── php_json_scanner.h
│       │   ├── libxml
│       │   │   └── php_libxml.h
│       │   ├── mbstring
│       │   │   ├── libmbfl
│       │   │   │   ├── config.h
│       │   │   │   └── mbfl
│       │   │   │       ├── eaw_table.h
│       │   │   │       ├── mbfilter_8bit.h
│       │   │   │       ├── mbfilter.h
│       │   │   │       ├── mbfilter_pass.h
│       │   │   │       ├── mbfilter_wchar.h
│       │   │   │       ├── mbfl_allocators.h
│       │   │   │       ├── mbfl_consts.h
│       │   │   │       ├── mbfl_convert.h
│       │   │   │       ├── mbfl_defs.h
│       │   │   │       ├── mbfl_encoding.h
│       │   │   │       ├── mbfl_filter_output.h
│       │   │   │       ├── mbfl_ident.h
│       │   │   │       ├── mbfl_language.h
│       │   │   │       ├── mbfl_memory_device.h
│       │   │   │       └── mbfl_string.h
│       │   │   ├── mbstring.h
│       │   │   ├── oniguruma
│       │   │   │   └── oniguruma.h
│       │   │   ├── php_mbregex.h
│       │   │   └── php_onig_compat.h
│       │   ├── mysqli
│       │   │   ├── mysqli_mysqlnd.h
│       │   │   └── php_mysqli_structs.h
│       │   ├── mysqlnd
│       │   │   ├── config-win.h
│       │   │   ├── mysql_float_to_double.h
│       │   │   ├── mysqlnd_alloc.h
│       │   │   ├── mysqlnd_auth.h
│       │   │   ├── mysqlnd_block_alloc.h
│       │   │   ├── mysqlnd_charset.h
│       │   │   ├── mysqlnd_commands.h
│       │   │   ├── mysqlnd_connection.h
│       │   │   ├── mysqlnd_debug.h
│       │   │   ├── mysqlnd_enum_n_def.h
│       │   │   ├── mysqlnd_ext_plugin.h
│       │   │   ├── mysqlnd.h
│       │   │   ├── mysqlnd_libmysql_compat.h
│       │   │   ├── mysqlnd_plugin.h
│       │   │   ├── mysqlnd_portability.h
│       │   │   ├── mysqlnd_priv.h
│       │   │   ├── mysqlnd_protocol_frame_codec.h
│       │   │   ├── mysqlnd_ps.h
│       │   │   ├── mysqlnd_read_buffer.h
│       │   │   ├── mysqlnd_result.h
│       │   │   ├── mysqlnd_result_meta.h
│       │   │   ├── mysqlnd_reverse_api.h
│       │   │   ├── mysqlnd_statistics.h
│       │   │   ├── mysqlnd_structs.h
│       │   │   ├── mysqlnd_vio.h
│       │   │   ├── mysqlnd_wireprotocol.h
│       │   │   └── php_mysqlnd.h
│       │   ├── pcre
│       │   │   ├── pcrelib
│       │   │   │   ├── config.h
│       │   │   │   ├── pcre.h
│       │   │   │   ├── pcre_internal.h
│       │   │   │   ├── pcreposix.h
│       │   │   │   └── ucp.h
│       │   │   └── php_pcre.h
│       │   ├── pdo
│       │   │   ├── php_pdo_driver.h
│       │   │   ├── php_pdo_error.h
│       │   │   └── php_pdo.h
│       │   ├── phar
│       │   │   └── php_phar.h
│       │   ├── session
│       │   │   ├── mod_files.h
│       │   │   ├── mod_user.h
│       │   │   └── php_session.h
│       │   ├── simplexml
│       │   │   ├── php_simplexml_exports.h
│       │   │   └── php_simplexml.h
│       │   ├── sockets
│       │   │   └── php_sockets.h
│       │   ├── spl
│       │   │   ├── php_spl.h
│       │   │   ├── spl_array.h
│       │   │   ├── spl_directory.h
│       │   │   ├── spl_dllist.h
│       │   │   ├── spl_engine.h
│       │   │   ├── spl_exceptions.h
│       │   │   ├── spl_fixedarray.h
│       │   │   ├── spl_functions.h
│       │   │   ├── spl_heap.h
│       │   │   ├── spl_iterators.h
│       │   │   └── spl_observer.h
│       │   ├── sqlite3
│       │   │   └── libsqlite
│       │   │       └── sqlite3.h
│       │   ├── standard
│       │   │   ├── base64.h
│       │   │   ├── basic_functions.h
│       │   │   ├── crc32.h
│       │   │   ├── credits_ext.h
│       │   │   ├── credits.h
│       │   │   ├── credits_sapi.h
│       │   │   ├── crypt_blowfish.h
│       │   │   ├── crypt_freesec.h
│       │   │   ├── css.h
│       │   │   ├── cyr_convert.h
│       │   │   ├── datetime.h
│       │   │   ├── dl.h
│       │   │   ├── exec.h
│       │   │   ├── file.h
│       │   │   ├── flock_compat.h
│       │   │   ├── fsock.h
│       │   │   ├── head.h
│       │   │   ├── html.h
│       │   │   ├── html_tables.h
│       │   │   ├── info.h
│       │   │   ├── md5.h
│       │   │   ├── microtime.h
│       │   │   ├── pack.h
│       │   │   ├── pageinfo.h
│       │   │   ├── php_array.h
│       │   │   ├── php_assert.h
│       │   │   ├── php_browscap.h
│       │   │   ├── php_crypt.h
│       │   │   ├── php_crypt_r.h
│       │   │   ├── php_dir.h
│       │   │   ├── php_dns.h
│       │   │   ├── php_ext_syslog.h
│       │   │   ├── php_filestat.h
│       │   │   ├── php_fopen_wrappers.h
│       │   │   ├── php_ftok.h
│       │   │   ├── php_http.h
│       │   │   ├── php_image.h
│       │   │   ├── php_incomplete_class.h
│       │   │   ├── php_iptc.h
│       │   │   ├── php_lcg.h
│       │   │   ├── php_link.h
│       │   │   ├── php_mail.h
│       │   │   ├── php_math.h
│       │   │   ├── php_metaphone.h
│       │   │   ├── php_mt_rand.h
│       │   │   ├── php_password.h
│       │   │   ├── php_rand.h
│       │   │   ├── php_random.h
│       │   │   ├── php_smart_string.h
│       │   │   ├── php_smart_string_public.h
│       │   │   ├── php_standard.h
│       │   │   ├── php_string.h
│       │   │   ├── php_type.h
│       │   │   ├── php_uuencode.h
│       │   │   ├── php_var.h
│       │   │   ├── php_versioning.h
│       │   │   ├── proc_open.h
│       │   │   ├── quot_print.h
│       │   │   ├── scanf.h
│       │   │   ├── sha1.h
│       │   │   ├── streamsfuncs.h
│       │   │   ├── uniqid.h
│       │   │   ├── url.h
│       │   │   ├── url_scanner_ex.h
│       │   │   └── winver.h
│       │   └── xml
│       │       ├── expat_compat.h
│       │       └── php_xml.h
│       ├── include
│       ├── main
│       │   ├── build-defs.h
│       │   ├── fastcgi.h
│       │   ├── fopen_wrappers.h
│       │   ├── http_status_codes.h
│       │   ├── php_compat.h
│       │   ├── php_config.h
│       │   ├── php_content_types.h
│       │   ├── php_getopt.h
│       │   ├── php_globals.h
│       │   ├── php.h
│       │   ├── php_ini.h
│       │   ├── php_main.h
│       │   ├── php_memory_streams.h
│       │   ├── php_network.h
│       │   ├── php_open_temporary_file.h
│       │   ├── php_output.h
│       │   ├── php_reentrancy.h
│       │   ├── php_scandir.h
│       │   ├── php_stdint.h
│       │   ├── php_streams.h
│       │   ├── php_syslog.h
│       │   ├── php_ticks.h
│       │   ├── php_variables.h
│       │   ├── php_version.h
│       │   ├── rfc1867.h
│       │   ├── SAPI.h
│       │   ├── snprintf.h
│       │   ├── spprintf.h
│       │   └── streams
│       │       ├── php_stream_context.h
│       │       ├── php_stream_filter_api.h
│       │       ├── php_stream_glob_wrapper.h
│       │       ├── php_stream_mmap.h
│       │       ├── php_stream_plain_wrapper.h
│       │       ├── php_streams_int.h
│       │       ├── php_stream_transport.h
│       │       └── php_stream_userspace.h
│       ├── sapi
│       │   └── cli
│       │       └── cli.h
│       ├── TSRM
│       │   ├── readdir.h
│       │   ├── tsrm_config_common.h
│       │   ├── tsrm_config.h
│       │   ├── tsrm_config.w32.h
│       │   ├── TSRM.h
│       │   ├── tsrm_strtok_r.h
│       │   └── tsrm_win32.h
│       └── Zend
│           ├── zend_alloc.h
│           ├── zend_alloc_sizes.h
│           ├── zend_API.h
│           ├── zend_arena.h
│           ├── zend_ast.h
│           ├── zend_bitset.h
│           ├── zend_build.h
│           ├── zend_builtin_functions.h
│           ├── zend_closures.h
│           ├── zend_compile.h
│           ├── zend_config.h
│           ├── zend_config.nw.h
│           ├── zend_config.w32.h
│           ├── zend_constants.h
│           ├── zend_dtrace.h
│           ├── zend_errors.h
│           ├── zend_exceptions.h
│           ├── zend_execute.h
│           ├── zend_extensions.h
│           ├── zend_float.h
│           ├── zend_gc.h
│           ├── zend_generators.h
│           ├── zend_globals.h
│           ├── zend_globals_macros.h
│           ├── zend.h
│           ├── zend_hash.h
│           ├── zend_highlight.h
│           ├── zend_inheritance.h
│           ├── zend_ini.h
│           ├── zend_ini_parser.h
│           ├── zend_ini_scanner_defs.h
│           ├── zend_ini_scanner.h
│           ├── zend_interfaces.h
│           ├── zend_istdiostream.h
│           ├── zend_iterators.h
│           ├── zend_language_parser.h
│           ├── zend_language_scanner_defs.h
│           ├── zend_language_scanner.h
│           ├── zend_list.h
│           ├── zend_llist.h
│           ├── zend_long.h
│           ├── zend_modules.h
│           ├── zend_multibyte.h
│           ├── zend_multiply.h
│           ├── zend_object_handlers.h
│           ├── zend_objects_API.h
│           ├── zend_objects.h
│           ├── zend_operators.h
│           ├── zend_portability.h
│           ├── zend_ptr_stack.h
│           ├── zend_range_check.h
│           ├── zend_signal.h
│           ├── zend_smart_str.h
│           ├── zend_smart_string.h
│           ├── zend_smart_string_public.h
│           ├── zend_smart_str_public.h
│           ├── zend_sort.h
│           ├── zend_stack.h
│           ├── zend_stream.h
│           ├── zend_string.h
│           ├── zend_strtod.h
│           ├── zend_strtod_int.h
│           ├── zend_ts_hash.h
│           ├── zend_type_info.h
│           ├── zend_types.h
│           ├── zend_variables.h
│           ├── zend_virtual_cwd.h
│           ├── zend_vm_def.h
│           ├── zend_vm_execute.h
│           ├── zend_vm.h
│           └── zend_vm_opcodes.h
├── lib
│   └── php
│       ├── Archive
│       │   └── Tar.php
│       ├── build
│       │   ├── acinclude.m4
│       │   ├── ax_check_compile_flag.m4
│       │   ├── config.guess
│       │   ├── config.sub
│       │   ├── libtool.m4
│       │   ├── ltmain.sh
│       │   ├── Makefile.global
│       │   ├── mkdep.awk
│       │   ├── phpize.m4
│       │   ├── run-tests.php
│       │   ├── scan_makefile_in.awk
│       │   └── shtool
│       ├── Console
│       │   └── Getopt.php
│       ├── data
│       │   └── PEAR
│       │       ├── package.dtd
│       │       └── template.spec
│       ├── doc
│       │   ├── Archive_Tar
│       │   │   └── docs
│       │   │       └── Archive_Tar.txt
│       │   ├── PEAR
│       │   │   ├── INSTALL
│       │   │   ├── LICENSE
│       │   │   └── README.rst
│       │   ├── Structures_Graph
│       │   │   ├── docs
│       │   │   │   └── tutorials
│       │   │   │       └── Structures_Graph
│       │   │   │           └── Structures_Graph.pkg
│       │   │   └── LICENSE
│       │   └── XML_Util
│       │       └── examples
│       │           ├── example2.php
│       │           └── example.php
│       ├── OS
│       │   └── Guess.php
│       ├── PEAR
│       │   ├── Builder.php
│       │   ├── ChannelFile
│       │   │   └── Parser.php
│       │   ├── ChannelFile.php
│       │   ├── Command
│       │   │   ├── Auth.php
│       │   │   ├── Auth.xml
│       │   │   ├── Build.php
│       │   │   ├── Build.xml
│       │   │   ├── Channels.php
│       │   │   ├── Channels.xml
│       │   │   ├── Common.php
│       │   │   ├── Config.php
│       │   │   ├── Config.xml
│       │   │   ├── Install.php
│       │   │   ├── Install.xml
│       │   │   ├── Mirror.php
│       │   │   ├── Mirror.xml
│       │   │   ├── Package.php
│       │   │   ├── Package.xml
│       │   │   ├── Pickle.php
│       │   │   ├── Pickle.xml
│       │   │   ├── Registry.php
│       │   │   ├── Registry.xml
│       │   │   ├── Remote.php
│       │   │   ├── Remote.xml
│       │   │   ├── Test.php
│       │   │   └── Test.xml
│       │   ├── Command.php
│       │   ├── Common.php
│       │   ├── Config.php
│       │   ├── Dependency2.php
│       │   ├── DependencyDB.php
│       │   ├── Downloader
│       │   │   └── Package.php
│       │   ├── Downloader.php
│       │   ├── ErrorStack.php
│       │   ├── Exception.php
│       │   ├── Frontend
│       │   │   └── CLI.php
│       │   ├── Frontend.php
│       │   ├── Installer
│       │   │   ├── Role
│       │   │   │   ├── Cfg.php
│       │   │   │   ├── Cfg.xml
│       │   │   │   ├── Common.php
│       │   │   │   ├── Data.php
│       │   │   │   ├── Data.xml
│       │   │   │   ├── Doc.php
│       │   │   │   ├── Doc.xml
│       │   │   │   ├── Ext.php
│       │   │   │   ├── Ext.xml
│       │   │   │   ├── Man.php
│       │   │   │   ├── Man.xml
│       │   │   │   ├── Php.php
│       │   │   │   ├── Php.xml
│       │   │   │   ├── Script.php
│       │   │   │   ├── Script.xml
│       │   │   │   ├── Src.php
│       │   │   │   ├── Src.xml
│       │   │   │   ├── Test.php
│       │   │   │   ├── Test.xml
│       │   │   │   ├── Www.php
│       │   │   │   └── Www.xml
│       │   │   └── Role.php
│       │   ├── Installer.php
│       │   ├── PackageFile
│       │   │   ├── Generator
│       │   │   │   ├── v1.php
│       │   │   │   └── v2.php
│       │   │   ├── Parser
│       │   │   │   ├── v1.php
│       │   │   │   └── v2.php
│       │   │   ├── v1.php
│       │   │   ├── v2
│       │   │   │   ├── rw.php
│       │   │   │   └── Validator.php
│       │   │   └── v2.php
│       │   ├── PackageFile.php
│       │   ├── Packager.php
│       │   ├── Proxy.php
│       │   ├── Registry.php
│       │   ├── REST
│       │   │   ├── 10.php
│       │   │   ├── 11.php
│       │   │   └── 13.php
│       │   ├── REST.php
│       │   ├── RunTest.php
│       │   ├── Task
│       │   │   ├── Common.php
│       │   │   ├── Postinstallscript
│       │   │   │   └── rw.php
│       │   │   ├── Postinstallscript.php
│       │   │   ├── Replace
│       │   │   │   └── rw.php
│       │   │   ├── Replace.php
│       │   │   ├── Unixeol
│       │   │   │   └── rw.php
│       │   │   ├── Unixeol.php
│       │   │   ├── Windowseol
│       │   │   │   └── rw.php
│       │   │   └── Windowseol.php
│       │   ├── Validate.php
│       │   ├── Validator
│       │   │   └── PECL.php
│       │   └── XMLParser.php
│       ├── pearcmd.php
│       ├── PEAR.php
│       ├── peclcmd.php
│       ├── Structures
│       │   ├── Graph
│       │   │   ├── Manipulator
│       │   │   │   ├── AcyclicTest.php
│       │   │   │   └── TopologicalSorter.php
│       │   │   └── Node.php
│       │   └── Graph.php
│       ├── System.php
│       ├── test
│       │   ├── Console_Getopt
│       │   │   └── tests
│       │   │       ├── 001-getopt.phpt
│       │   │       ├── bug10557.phpt
│       │   │       ├── bug11068.phpt
│       │   │       └── bug13140.phpt
│       │   ├── Structures_Graph
│       │   │   └── tests
│       │   │       ├── AcyclicTestTest.php
│       │   │       ├── AllTests.php
│       │   │       ├── BasicGraphTest.php
│       │   │       ├── helper.inc
│       │   │       └── TopologicalSorterTest.php
│       │   └── XML_Util
│       │       └── tests
│       │           ├── AbstractUnitTests.php
│       │           ├── ApiVersionTests.php
│       │           ├── AttributesToStringTests.php
│       │           ├── Bug18343Tests.php
│       │           ├── Bug21177Tests.php
│       │           ├── Bug21184Tests.php
│       │           ├── Bug4950Tests.php
│       │           ├── Bug5392Tests.php
│       │           ├── CollapseEmptyTagsTests.php
│       │           ├── CreateCDataSectionTests.php
│       │           ├── CreateCommentTests.php
│       │           ├── CreateEndElementTests.php
│       │           ├── CreateStartElementTests.php
│       │           ├── CreateTagFromArrayTests.php
│       │           ├── CreateTagTests.php
│       │           ├── GetDocTypeDeclarationTests.php
│       │           ├── GetXmlDeclarationTests.php
│       │           ├── IsValidNameTests.php
│       │           ├── RaiseErrorTests.php
│       │           ├── ReplaceEntitiesTests.php
│       │           ├── ReverseEntitiesTests.php
│       │           └── SplitQualifiedNameTests.php
│       └── XML
│           └── Util.php
├── php
│   ├── man
│   │   ├── man1
│   │   │   ├── phar.1
│   │   │   ├── phar.phar.1
│   │   │   ├── php.1
│   │   │   ├── php-cgi.1
│   │   │   ├── php-config.1
│   │   │   ├── phpdbg.1
│   │   │   └── phpize.1
│   │   └── man8
│   │       └── php-fpm.8
│   └── php
│       └── fpm
│           └── status.html
├── sbin
│   └── php-fpm
└── var
    ├── log
    └── run

98 directories, 490 files
View Code

六 启动并测试

cp /tools/php-7.2.8/sapi/fpm/init.d.php-fpm /etc/init.d/php.fpm
chmod +x /etc/init.d/php.fpm
chmod +x /etc/init.d/php.fpm start

[root@centos7 sbin]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 57529/php-fpm: mast

七 Nginx配置php

        location / {
            root   html;
            index  index.php index.html index.htm;
        }


    location ~ .php$ {
            fastcgi_pass  127.0.0.1:9000;
           # fastcgi_pass  unix:/var/run/php-fcgi.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
            include fastcgi_params;
            }

八 编写php-fpm启动文件

[root@centos7 php-fpm.d]# cat /etc/systemd/system/php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/var/log/php-fpm/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.targe

九 nginx检查配置并重启

[root@centos7 sbin]# nginx -t
nginx: the configuration file /usr/local/nginx-1.15.2/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx-1.15.2/conf/nginx.conf test is successful
[root@centos7 sbin]# systemctl restart nginx

十  网页浏览验证

原文地址:https://www.cnblogs.com/yanshicheng/p/9456829.html