php7.4配置文件,Centos8中php7.4安装,附配置文件及常用命令

1、安装dnf管理

yum install epel-release -y

yum install dnf -y

2、添加存储库

#要在CentOS 8上安装并启用EPEL存储库,请执行以下dnf命令。

dnf install https://dl.Fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

#要确认EPEL存储库的存在,请运行以下rpm命令。

rpm -qa | grep epel

#接下来,运行以下命令以添加Remi存储库。

dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

#再次,以验证Remi存储库的存在,运行命令。

rpm -qa | grep remi

3、获取PHP模块并安装

#成功添加EPEL和Remi存储库后,执行以下命令以获取可用PHP模块流的列表。

dnf module list php

#从上面的输出中,remi-7.4 是最新的PHP流,因此我们将启用模块流,如下所示。

dnf module enable php:remi-7.4

#启用PHP remi-7.4模块后,即可使用以下命令继续并安装PHP。 这还将安装许多其他软件包,例如Apache和Nginx模块。

dnf -y install php php-cli php-common php-mysql php-cgi php-mbstring php-gd php-process php-mcrypt php-soap libjpeg* php-pear php-xml php-devel php-memcached php-redis php-gearman php-pecl-mongodb

#dnf -y install gearmand libgearman-devel

#dnf -y install redis memcached

4、设置环境

#要检查已安装的PHP版本,请运行命令。

php -v

#设置开机启动、运行服务:

systemctl enable php-fpm

systemctl start php-fpm

#其他服务参考命令

systemctl restart php-fpm#重启

systemctl start php-fpm#启动

systemctl stop php-fpm#关闭

systemctl status php-fpm#检查状态

5、相关辅助

http管理

systemctl start httpd #启动apache服务器

systemctl stop httpd #关闭apache服务器

systemctl enable httpd#设置开机自动启动

systemctl status httpd.service#检查httpd服务状态

附配置文件

php-fpm.conf

;;;;;;;;;;;;;;;;;;;;;

; FPM Configuration ;

;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install

; prefix.

; Include one or more files. If glob(3) exists, it is used to include a bunch of

; files from a glob(3) pattern. This directive can be used everywhere in the

; file.

include=/etc/php-fpm.d/*.conf

;;;;;;;;;;;;;;;;;;

; Global Options ;

;;;;;;;;;;;;;;;;;;

[global]

; pid设置,建议开启

; Pid file

; Default Value: none

pid = /run/php-fpm/php-fpm.pid

; 错误日志

; Error log file

; If it's set to "syslog", log is sent to syslogd instead of being written

; in a local file.

; Default Value: /var/log/php-fpm.log

error_log = /var/log/php-fpm/error.log

; syslog_facility is used to specify what type of program is logging the

; message. This lets syslogd specify that messages from different facilities

; will be handled differently.

; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)

; Default Value: daemon

;syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM

; instances running on the same server, you can change the default value

; which must suit common needs.

; Default Value: php-fpm

;syslog.ident = php-fpm

; Log level

; Possible Values: alert, error, warning, notice, debug

; Default Value: notice

; 错误级别

; 可用级别为: alert(必须立即处理), error(错误情况), warning(警告情况), notice(一般重要信息), debug(调试信息). 默认: notice.

;log_level = notice

; Log limit on number of characters in the single line (log entry). If the

; line is over the limit, it is wrapped on multiple lines. The limit is for

; all logged characters including message prefix and suffix if present. However

; the new line character does not count into it as it is present only when

; logging to a file descriptor. It means the new line character is not present

; when logging to syslog.

; Default Value: 1024

;log_limit = 4096

; Log buffering specifies if the log line is buffered which means that the

; line is written in a single write operation. If the value is false, then the

; data is written directly into the file descriptor. It is an experimental

; option that can potentionaly improve logging performance and memory usage

; for some heavy logging scenarios. This option is ignored if logging to syslog

; as it has to be always buffered.

; Default value: yes

;log_buffering = no

; If this number of child processes exit with SIGSEGV or SIGBUS within the time

; interval set by emergency_restart_interval then FPM will restart. A value

; of '0' means 'Off'.

; Default Value: 0

;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when

; a graceful restart will be initiated. This can be useful to work around

; accidental corruptions in an accelerator's shared memory.

; Available Units: s(econds), m(inutes), h(ours), or d(ays)

; Default Unit: seconds

; Default Value: 0

; 表示在emergency_restart_interval所设值内出现SIGSEGV或者SIGBUS错误的php-cgi进程数如果超过 emergency_restart_threshold个,php-fpm就会优雅重启。这两个选项一般保持默认值。

;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from master.

; Available units: s(econds), m(inutes), h(ours), or d(ays)

; Default Unit: seconds

; Default Value: 0

; 设置子进程接受主进程复用信号的超时时间. 可用单位: s(秒), m(分), h(小时), 或者 d(天) 默认单位: s(秒). 默认值: 0.

;process_control_timeout = 0

; The maximum number of processes FPM will fork. This has been designed to control

; the global number of processes when using dynamic PM within a lot of pools.

; Use it with caution.

; Note: A value of 0 indicates no limit

; Default Value: 0

;process.max = 128

; Specify the nice(2) priority to apply to the master process (only if set)

; The value can vary from -19 (highest priority) to 20 (lowest priority)

; Note: - It will only work if the FPM master process is launched as root

; - The pool process will inherit the master process priority

; unless specified otherwise

; Default Value: no set

;process.priority = -19

; 后台执行fpm

; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.

; Default Value: yes

; 默认值为yes,如果为了调试可以改为no。在FPM中,可以使用不同的设置来运行多个进程池。 这些设置可以针对每个进程池单独设置。

daemonize = yes

; Set open file descriptor rlimit for the master process.

; Default Value: system defined value

;rlimit_files = 1024

; Set max core size rlimit for the master process.

; Possible Values: 'unlimited' or an integer greater or equal to 0

; Default Value: system defined value

;rlimit_core = 0

; Specify the event mechanism FPM will use. The following is available:

; - select (any POSIX os)

; - poll (any POSIX os)

; - epoll (linux >= 2.5.44)

; Default Value: not set (auto detection)

;events.mechanism = epoll

; When FPM is built with systemd integration, specify the interval,

; in seconds, between health report notification to systemd.

; Set to 0 to disable.

; Available Units: s(econds), m(inutes), h(ours)

; Default Unit: seconds

; Default value: 10

;systemd_interval = 10

;;;;;;;;;;;;;;;;;;;;

; Pool Definitions ;

;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different listening

; ports and different management options. The name of the pool will be

; used in logs and stats. There is no limitation on the number of pools which

; FPM can handle. Your system will tell you anyway :)

; See /etc/php-fpm.d/*.conf

常用命令

1、查找安装包:

rpm -qa | grep 'php'

2、找到某个包位置 rpm -ql

#如查找php-fpm-7.4.7-1.el8.remi.x86_64安装位置

rpm -ql php-fpm-7.4.7-1.el8.remi.x86_64

3、查看php.ini应当存放的路径

php -i | grep ini

#直接查找

php -i | grep php.ini

4、有关错误的配置:

error_log 错误日志的生成目录(~/etc/php-fpm.conf)

error_reporting 生产环境错误级别应全开(~/lib/php.ini)

display_errors 在页面上不显示错误(~/lib/php.ini)

log_errors 开启错误日志(~/lib/php.ini)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值