修改 PHP-FPM listen 的方式

若想將 PHP-FPM listen 的方式,改成 unix socket,可以編輯 /etc/php-fpm.d/www.conf

listen = 127.0.0.1:9000

改成

listen = /var/run/php-fpm/php-fpm.sock

然後重新啟動 php-fpm

systemctl restart php-fpm

註:不要改成 listen = /tmp/php-fcgi.sock (將 php-fcgi.sock 設定在 /tmp 底下), 因為系統產生 php-fcgi.sock 時,會放在 /tmp/systemd-private-*/tmp/php-fpm.sock 隨機私有目錄下, 除非把 /usr/lib/systemd/system/ 裡面的 PrivateTmp=true 設定改成 PrivateTmp=false, 但還是會產生其他問題,所以還是換個位置最方便

删除之前的版本

# yum remove php*

rpm 安装 Php7 相应的 yum源

CentOS/RHEL 7.x:

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

yum安装php7

yum install php70w php70w-opcache

安装其他插件(选装)

注:如果安装pear,需要安装php70w-devel

php70w

php70w-bcmath

php70w-cli

php70w-common

php70w-dba

php70w-devel

php70w-embedded

php70w-enchant

php70w-fpm

php70w-gd

php70w-imap

php70w-interbase

php70w-intl

php70w-ldap

php70w-mbstring

php70w-mcrypt

php70w-mysql

php70w-mysqlnd

php70w-odbc

php70w-opcache

php70w-pdo

php70w-pdo_dblib

php70w-pear

php70w-pecl-apcu

php70w-pecl-imagick

php70w-pecl-xdebug

php70w-pgsql

php70w-phpdbg

php70w-process

php70w-pspell

php70w-recode

php70w-snmp

php70w-soap

php70w-tidy

php70w-xml

php70w-xmlrp

编译安装php7

配置(configure)、编译(make)、安装(make install)

使用configure --help

编译安装一定要指定定prefix,这是安装目录,会把所有文件限制在这个目录,卸载时只需要删除那个目录就可以,如果不指定会安装到很多地方,后边删除不方便。

Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print `checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX

注意

内存小于1G安装往往会出错,在编译参数后面加上一行内容--disable-fileinfo

其他配置参数

--exec-prefix=EXEC-PREFIX

可以把体系相关的文件安装到一个不同的位置,而不是PREFIX设置的地方.这样做可以比较方便地在不同主机之间共享体系相关的文件

--bindir=DIRECTORY

为可执行程序声明目录,缺省是 EXEC-PREFIX/bin

--datadir=DIRECTORY

设置所安装的程序需要的只读文件的目录.缺省是 PREFIX/share

--sysconfdir=DIRECTORY

用于各种各样配置文件的目录,缺省为 PREFIX/etc

--libdir=DIRECTORY

库文件和动态装载模块的目录.缺省是 EXEC-PREFIX/lib

--includedir=DIRECTORY

C 和 C++ 头文件的目录.缺省是 PREFIX/include

--docdir=DIRECTORY

文档文件,(除 “man(手册页)”以外, 将被安装到这个目录.缺省是 PREFIX/doc

--mandir=DIRECTORY

随着程序一起带的手册页 将安装到这个目录.在它们相应的manx子目录里. 缺省是PREFIX/man

注意: 为了减少对共享安装位置(比如 /usr/local/include) 的污染,configure 自动在 datadir, sysconfdir,includedir, 和 docdir 上附加一个 “/postgresql” 字串, 除非完全展开以后的目录名字已经包含字串 “postgres” 或者 “pgsql”.比如,如果你选择 /usr/local 做前缀,那么 C 的头文件将安装到 /usr/local/include/postgresql, 但是如果前缀是 /opt/postgres,那么它们将 被放进 /opt/postgres/include

--with-includes=DIRECTORIES

DIRECTORIES 是一系列冒号分隔的目录,这些目录将被加入编译器的头文件 搜索列表中.如果你有一些可选的包(比如 GNU Readline)安装在 非标准位置,你就必须使用这个选项,以及可能还有相应的 --with-libraries 选项.

--with-libraries=DIRECTORIES

DIRECTORIES 是一系列冒号分隔的目录,这些目录是用于查找库文件的. 如果你有一些包安装在非标准位置,你可能就需要使用这个选项 (以及对应的--with-includes选项)

--enable-XXX

打开XXX支持

--with-XXX

制作XXX模块

PHP FPM設定參考

[global]

pid = /usr/local/php/var/run/php-fpm.pid

error_log = /usr/local/php/var/log/php-fpm.log

[www]

listen = /var/run/php-fpm/php-fpm.sock

user = www

group = www

pm = dynamic

pm.max_children = 800

pm.start_servers = 200

pm.min_spare_servers = 100

pm.max_spare_servers = 800

pm.max_requests = 4000

rlimit_files = 51200

listen.backlog = 65536

;設 65536 的原因是-1 可能不是unlimited

;說明 http://php.net/manual/en/install.fpm.configuration.php#104172

slowlog = /usr/local/php/var/log/slow.log

request_slowlog_timeout = 10

nginx.conf 設定參考

user nginx;

worker_processes 8;

error_log /var/log/nginx/error.log warn;

pid /var/run/nginx.pid;

events {

use epoll;

worker_connections 65535;

}

worker_rlimit_nofile 65535;

#若沒設定,可能出現錯誤:65535 worker_connections exceed open file resource limit: 1024

http {

include /etc/nginx/mime.types;

default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;

tcp_nopush on;

keepalive_timeout 65;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 8m;

server_tokens off;

client_body_buffer_size 512k;

# fastcgi

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

fastcgi_intercept_errors on;

#gzip (說明 http://nginx.org/en/docs/http/ngx_http_gzip_module.html)

gzip off;

gzip_min_length 1k;#1k以上才壓縮

gzip_buffers 32 4k;

#http://stackoverflow.com/questions/4888067/how-to-get-linux-kernel-page-size-programatically

#使用 getconf PAGESIZE 取得系統 one memory page size,

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types text/css text/xml application/javascript application/atom+xml application/rss+xml text/plain application/json;

#查看 nginx 的 mime.types 檔案(/etc/nginx/mime.types),裡面有各種類型的定義

gzip_vary on;

include /etc/nginx/conf.d/*.conf;

}

若出現出現錯誤:setrlimit(RLIMIT_NOFILE, 65535) failed (1: Operation not permitted)

先查看目前系統的設定值

ulimit -n

若設定值太小,修改 /etc/security/limits.conf

vi /etc/security/limits.conf

加上或修改以下兩行設定

* soft nofile 65535

* hard nofile 65535

php70wfpm,CentOS 7 安裝 Nginx、PHP7、PHP-FPM相关推荐

  1. fedora nginx php,在fedora16下安裝nginx + php-fpm

    在fedora16下安裝nginx + php-fpm 1.安装Nginx 直接运行如下命令: yum install nginx 然后我们创建系统启动nginx的链接,并启动它: systemctl ...

  2. CentOS下安裝Nvidia docker 2.0:[Errno 256] No more mirrors to try錯誤及解決方式

    CentOS下安裝Nvidia docker 2.0:[Errno 256] No more mirrors to try. [Errno 14] HTTPS Error 404 - Not Foun ...

  3. [Python學習筆記] 在Centos上安裝 Django

    曾在模擬器跟Digital Ocean上安裝成功,我在 Digital Ocean上的是CentOS 7 x64,模擬器的則是Centos 6. 雖然Centos 本身已經裝好 Python 但是是2 ...

  4. CentOS 7安裝视频解码器

    装了centos,但不能播放视频...我要看视频学习啊... 下载gstreamer 链接:http://pan.baidu.com/s/1yLcRW 密码:h159 解压后放到 /usr/lib64 ...

  5. mysql5.7版本源_用最新MySQL 8.0的源安裝MySQL 5.7版本(CentOS 7環境下)

    起因: 從官網下了MySQL最新8.0版本的源,安裝了MySQL 8.0.13,但是發現版本太新了跟其他軟件不兼容,而且改了半天其他軟件配置都沒改好(囧rz)...算了,卸載了8.0,還是安回5.7的 ...

  6. 沈逸老师ubuntu速学笔记(2)-- ubuntu16.04下 apache2.4和php7结合编译安装,并安裝PDOmysql扩展...

    1.编译安装apache2.4.20 1 第一步: ./configure --prefix=/usr/local/httpd --enable-so 2 第二步: make 3 第三步: sudo ...

  7. worker mpm php,Ubuntu 16.04 安裝 Apache2.4 + mpm_worker + fastcgi + php7.0

    之前寫過一篇 Ubuntu 16.04 在 Apache2.4 跑 PHP7.0 是用 mod_php 跑來的,而 mod_php 是使用 mpm_prefork 來跑,這篇主要要說的是 mpm_wo ...

  8. Apache Maven 3.0.3 (yum) 安裝 (CentOS 6.4 x64)

    介紹 http://maven.apache.org/ Maven是一個專案的開發,管理和綜合工具. 下載 http://maven.apache.org/download.cgi 參考 http:/ ...

  9. CentOS 5.4 安裝 boost 1.4.1 筆記 - 杨毅的电子笔记

    CentOS 5.4 安裝 boost 1.4.1 筆記 - 杨毅的电子笔记 CentOS 5.4 安裝 boost 1.4.1 筆記 - 杨毅的电子笔记 CentOS 5.4 安裝 boost 1. ...

最新文章

  1. 史上最强 NIO 框架,没有之一!!!
  2. linux io读写次数 oid,Oidiomycosis in Porto Rico.
  3. Android 核心分析之十二Android GEWS窗口管理之基本架构原理
  4. 狼叔直播 Reaction《学习指北:Node.js 2022 全解析》
  5. 引用 Map 数据结构的排序问题
  6. (BFS)Meteor Shower (poj3669)
  7. 8086/8088内部结构
  8. Boostrap日期时间选择器
  9. java dataurl_FileReader生成图片dataurl的分析
  10. 谷歌拼音输入法快速切换中英文解决中英文混合打字问题
  11. Unity3d面向英特尔® x86 平台的 Unity* 优化指南: 第 3 部分
  12. python代码中函有中文报错的解决方法
  13. Android ImageButton单击切换按钮图片效果
  14. Entity Framework 复杂类型
  15. Mac安装telnet工具和使用
  16. Ubuntu系统下安装Gaussian09和GaussianView5(GS16和GV6安装同理)
  17. API接口设计的五大公共参数
  18. C#实现给图片加边框的方法
  19. python中%s是什么意思_python的%s是什么意思
  20. 互联网黑暗森林法则:想活?别喘气儿!

热门文章

  1. (译)如何使用cocos2d制作一个塔防游戏:第三部分
  2. 马云在《赢在中国》对创业者的经典点评
  3. node升级命令_Vue CLI 4 发布:自动化升级过程,支持自定义包管理器
  4. c语言1076素数,大学C语言考试题库(答案)-20210412093908.docx-原创力文档
  5. c语言程序的基本规范是什么,C语言编程规范——3 命名规则
  6. java自带数据库_Derby-jdk自带数据库的使用 - Java天堂
  7. python api加快交易速度_使用Python3的pipedriveapi将交易输出限制为1000个交易
  8. java中file对象_Java中File对象的常用方法
  9. 新高考改革选计算机专业要学什么,2020高考改革后考生如何选科与选专业?
  10. 怎样实现linux的网络通信协议是,一种基于Linux系统的TCP/IP协议栈的实现