日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

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

發布時間:2023/12/8 php 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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)

總結

以上是生活随笔為你收集整理的php7.4配置文件,Centos8中php7.4安装,附配置文件及常用命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。