1 安装php所需要的扩展 yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel gd gd-devel
2 安装php ./configure --prefix=/usr/local/php7.2 --enable-shared --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir --with-openssl --with-curl --with-zlib-dir -with-gettext --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv --with-config-file-path=/usr/local/php7.2/etc --enable-mbstring --with-gd --disable-debug --enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets --with-mhash --enable-zip --enable-opcache --enable-inline-optimization make make install cp php.ini-production /usr/local/php7.2/etc/php.ini
3 Edit Profile php edit php.ini file is provided below the short_open_tag = the On that the disable_functions = " DL, Exec, passthru, pcntl_exec, popen, posix_kill, posix_mkfifo, posix_setuid, proc_close, proc_open, proc_terminate, shell_exec, System, Leak, posix_setpgid, posix_setsid, proc_get_status, proc_nice, show_source " cgi.fix_pathinfo = 0 the date.timezone = Asia / of Shanghai the expose_php = Off
4 edit PHP- FPM profile CP PHP -fpm.conf. Default PHP- fpm.conf edit PHP - fpm.conf provided as PID = / usr / local / PHP7 / var / RUN / PHP- fpm.pid the error_log = log / PHP- fpm.log log_level = Notice process_control_timeout = 30 events.mechanism = the epoll the listen = 127.0 . 0.1 : 9007 listen.backlog = - . 1 pm.max_children = 1024 pm.start_servers = 80 pm.min_spare_servers = 20 pm.max_spare_servers = 80 pm.max_requests = 2000 pm.status_path = /status ping.path = /ping ping.response = pong slowlog = var/log/phpslow_$pool.log request_slowlog_timeout = 5s request_terminate_timeout = 60s rlimit_files = 65534 php_admin_value[open_basedir] = "/tmp/" php_admin_value[disable_functions] = dl,exec,leak,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system
4 Test PHP # Test PHP - FPM configuration / usr / local / PHP7. 2 / sbin / PHP-FPM - T . / Usr / local / PHP7 2 / sbin / PHP-FPM -C / usr / local / PHP7 / etc / -Y the php.ini / usr / local / PHP7. 2 /etc/php-fpm.conf - T # start PHP - FPM . / usr / local / PHP7 2 / sbin / PHP- FPM . / usr / local / PHP7 2 . / sbin / PHP-FPM -C /usr/local/php7/etc/php.ini -Y / usr / local / PHP7 2 / etc / PHP- fpm.conf # Close PHP - FPM the kill -INT `CAT / usr / local / PHP7. 2 / var / RUN / PHP-fpm.pid` # Restart PHP - FPM the kill . -USR2 `CAT / usr / local / PHP7 2 / var / RUN / PHP-fpm.pid`