tofacebook.com -专业IT技术社区 【百家号】脸书百科,PHP编译安装 Web程序 - tofacebook.com-专业IT技术社区
72°

【百家号】脸书百科,PHP编译安装 Web程序

标签:bsp   strong   use   shm   pcntl   Fix   libc   sqlite   enable   

一、前言

  (一)、概述

  (二)、预处理

配置环境   OS:CentOS 7.5 64bit   PHP版本:7.2.8
  hostname:php-1-1   ip:10.18.43.141
[[email protected]1-1 ~]# systemctl stop firewalld [[email protected]-1-1 ~]# sed -ri /^SELINUX=*/cSELINUX=disabled /etc/selinux/config [[email protected]-1-1 ~]# setenforce 0 [[email protected]-1-1 ~]# mkdir -p /date/php

二、安装

  (一)、PHP编译

依赖环境库下载

[[email protected]1-1 ~]# yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel

源码包获取及编译

[[email protected]1-1 ~]# wget -P /data/php/ http://cn2.php.net/distributions/php-7.2.8.tar.bz2
[[email protected]1-1 ~]# cd /data/php/ [[email protected]-1-1 php]# tar xf php-7.2.8.tar.bz2
[[email protected] php]# cd php-7.2.8/
[[email protected] php-7.2.8]#./configure \
--prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-ldap \
--with-gettext \
--with-iconv-dir \
--with-jpeg-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip \
--with-fpm-group=nginx \
--with-fpm-user=nginx

三、配置启动

  (一)、基础配置

[[email protected]1-1 php-7.2.8]#  cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/ [[email protected]-1-1 php-7.2.8]#  cp /usr/local/php/etc/{php-fpm.conf.default,php-fpm.conf} [[email protected]-1-1 php-7.2.8]#  cp /usr/local/php/etc/php-fpm.d/www.conf{.default,} [[email protected]-1-1 php-7.2.8]#  cp php.ini-production /usr/local/php/lib/php.ini

  (二)、参数配置

[[email protected]1-1 php-7.2.8]# sed -i /date.timezone =/s/.*/date.timezone = PRC/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -n 869p /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache]/azend_extension=opcache.so /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /;opcache.enable=1/s/;//g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache.enable_cli=/s/.*/opcache.enable_cli=1/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# echo "vm.nr_hugepages = 200" >> /etc/sysctl.conf [[email protected]-1-1 php-7.2.8]# sysctl -p [[email protected]-1-1 php-7.2.8]# sed -i /;opcache.huge_code_pages/s/;//g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache.memory_consumption=/s/.*/opcache.memory_consumption=512/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache.fast_shutdown=/s/.*/opcache.fast_shutdown=1/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache.validate_timestamps=/s/.*/opcache.validate_timestamps=1/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /opcache.revalidate_freq=/s/.*/opcache.revalidate_freq=2/g /usr/local/php/lib/php.ini [[email protected]-1-1 php-7.2.8]# sed -i /listen = 127.0.0.1/s/=.*/= 0.0.0.0:9000/g /usr/local/php/etc/php-fpm.d/www.conf

  (三)、启动使用

[[email protected]1-1 php-7.2.8]# systemctl start php-fpm.service [[email protected]-1-1 php-7.2.8]# systemctl enable php-fpm.service

 

PHP编译安装

标签:bsp   strong   use   shm   pcntl   Fix   libc   sqlite   enable   

原文地址:https://www.cnblogs.com/sky-k/p/9365134.html


本文由百家号/熊掌号作者上传并发布,百家号仅提供信息发布平台。文章仅代表作者个人观点,不代表百度立场。

已有 0 条评论

    我有话说: