yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel openldap openldap-devel libxslt libxslt-develcp -frp /usr/lib64/libldap* /usr/lib/ln -s /usr/lib64/liblber* /usr/lib/groupadd -g 58 nginxuseradd -u 58 -g 58 -M nginx -s /sbin/nologincd /usr/local/srcwget http://cn2.php.net/distributions/php-7.2.0.tar.gz
TAR-ZXVF php-7.2.0.tar.gzcd php-7.2.0/./configure--prefix=/usr/local/php7--exec-prefix=/usr/local/php7--bindir=/ Usr/local/php7/bin--sbindir=/usr/local/php7/sbin--includedir=/usr/local/php7/include--libdir=/usr/local/php7/ lib/php--mandir=/usr/local/php7/php/man--with-config-file-path=/usr/local/php7/etc--with-mysql-sock=/var/run/ MYSQL/MYSQL.SOCK-WITH-LIBXML-DIR=/USR--with-iconv-dir--with-mhash--with-openssl--with-mysqli=shared,mysqlnd-- With-pdo-mysql=shared,mysqlnd--with-gd--with-iconv--with-zlib--enable-zip--with-ldap=shared--WITH-LDAP-SASL-- Enable-inline-optimization--disable-debug--disable-rpath--enable-shared--enable-xml--enable-bcmath-- Enable-shmop--enable-sysvsem--enable-mbregex--enable-mbstring--enable-ftp--enable-pcntl--enable-sockets-- With-xmlrpc--enable-soap--without-pear--with-gettext--enable-session--with-curl--with-jpeg-dir-- With-freetype-dir--enable-opcache--enable-fpm--with-fpm-user=nginx--with-fpm-group=nginx--without-GDBM--disable-fileinfo--with-xslmake && make installll/usr/local/php7/lib/php/extensions/ no-debug-non-zts-20170718/
Direct use of post-compilation, non-optimized configuration CP PHP.INI-PRODUCTION/USR/LOCAL/PHP7/ETC/PHP.INICP sapi/fpm/init.d.php-fpm/etc/init.d/ PHP-FPM Modifying a configuration file vim/usr/local/php7/etc/php.ini##### #避免PHP信息暴露在http头中expose_php = off###### Avoid exposing PHP error messages called MySQL display_errors = off##### #在关闭display_errors后开启PHP错误日志 (path is configured in php-fpm.conf) log_errors = on###### Set the extension library path for PHP extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/" ###### Set up PHP's Opcache and MySQL dynamic library zend_extension=opcache.soextension=mysqli.soextension=pdo_mysql.soextension=ldap.so##### #设置PHP的时区date. TimeZone = prc##### #开启opcache [opcache]opcache.enable=1##### #设置PHP脚本允许访问的目录 (needs to be configured according to the actual situation) Open_basedir =/etc/nginx/html;vim/usr/local/php7/etc/php-fpm.conf[global]pid =/usr/local/php7/var/run/php-fpm.piderror_log =/ Usr/local/php7/var/log/php-fpm.loglog_level = Notice[www]listen =/var/run/php-fpm/php-fpm.sock # # # or 127.0.0.1: 9000listen.backlog = -1listen.allowed_clients = 127.0.0.1listen.owner = Nginxlisten.group = Nginxlisten.mode = 0666user = Nginxgroup = nginxpm = Dynamicpm.max_children = 80pm.start_servers = 40pm.min_spare_servers = 40pm.max_spare_servers = 80request_ Terminate_timeout = 100request_slowlog_timeout = 10sslowlog =/var/log/php-fpm/$pool-slow.log###### Set the Session Directory for PHP (both user and user groups are Nginx) Php_value[session.save_handler] = Filesphp_value[session.save_path] =/var/lib/php /sessionecho-e ' \nexport path=/usr/local/php7/bin:/usr/local/php7/sbin: $PATH \ n ' >>/etc/profile && Source/etc/profilemkdir-p/var/log/php-fpm/&& mkdir-p/var/run/php-fpm && cd/var/run/&& Chow N-r nginx:nginx php-fpmmkdir-p/var/lib/php/sessionchown-r nginx:nginx/var/lib/phpchmod +x/etc/init.d/ Php-fpmchkconfig--add php-fpmchkconfig php-fpm onphp-fpm-tservice php-fpm Startps-aux | grep PHP # #php-FPM process number and process user Nginx are determined by the values of pm.start_servers and user respectively root 26007 0.0 0.0 182016 6324? Ss 13:36 0:00 php-fpm:master process (/usr/local/php7/etc/php-fpm.conf) nginx 26008 0.0 0.0 182016 5884? S 13:36 0:00 php-fpm:pool wwwnginx 26009 0.0 0.0 182016 5884? S 13:36 0:00 Php-fpm:pool www
PHP 7.2 Compilation installation