찾다
백엔드 개발PHP 문제PHP 구성 파일은 무엇입니까?

nginx와 함께 사용되는 PHP에는 php.ini, php-fpm.conf, www.conf의 세 가지 구성 파일이 있습니다.

PHP 구성 파일은 무엇입니까?

php.ini는 PHP 런타임의 핵심 구성입니다. CLI 모드와 php-fpm 모드의 PHP 프로세스는 모두 php.ini의 구성 항목을 읽습니다. (추천 학습: PHP 비디오 튜토리얼)

php-fpm.conf는 php-fpm 관리 하에 있는 php 프로세스의 구성 파일입니다. 이 모드에서 실행되는 PHP 프로세스는 php.ini의 구성 항목을 읽는 것 외에도
php-fpm.conf의 구성 항목도 읽습니다.

www.conf는 php-fpm.conf의 보충입니다.

php.ini의 중요 구성

######避免PHP信息暴露在http头中
expose_php = Off

######避免暴露php错误信息
display_errors = Off

######在关闭display_errors后开启PHP错误日志(路径在php-fpm.conf中配置)
log_errors = On

######设置PHP的扩展库路径
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/"

######设置PHP的opcache和mysql动态库
zend_extension=opcache.so
extension=mysqli.so
extension=pdo_mysql.so

######设置PHP的时区
date.timezone = PRC

######开启opcache
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

######设置PHP脚本允许访问的目录(需要根据实际情况配置)
;open_basedir = /usr/share/nginx/html;

php-fpm.conf의 중요 구성# 🎜🎜 #

;php运行日志
error_log=log/php-fpm.log
;FPM使用的事件机制
events.mechanism = epoll
;php-fpm.conf的补充文件www.conf的路径include=/usr/cg/lnmp/php-7.0.13/etc/php-fpm.d/*.conf

www.conf의 중요 구성

;php-fpm运行的linux用户组和用户
user = www
group = www
;接收FastCGI请求的地址
listen = 127.0.0.1:9000; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives. With this process management, there will be
;             always at least 1 children.
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle';                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle';                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
;  ondemand - no children are created at startup. Children will be forked when
;             new requests will connect. The following parameter are used:
;             pm.max_children           - the maximum number of children that
;                                         can be alive at the same time.
;             pm.process_idle_timeout   - The number of seconds after which
;                                         an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
;php进程在回收前应该处理的请求
;防止第三方库的内存泄漏
pm.max_requests = 500
;耗时长的php处理日志
slowlog = log/$pool.log.slow
;php慢日志的时间标准,最小单位是秒,0是未开启慢日志
request_slowlog_timeout = 0
; 可在php文件中通过getenv('TEMP')获取环境变量的值
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
env[TEMP] = /tmp
; 覆盖php.ini中的对应配置
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 32M

위 내용은 PHP 구성 파일은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
산과 기본 데이터베이스 : 차이 및 각각을 사용 해야하는시기.산과 기본 데이터베이스 : 차이 및 각각을 사용 해야하는시기.Mar 26, 2025 pm 04:19 PM

이 기사는 산 및 기본 데이터베이스 모델을 비교하여 특성과 적절한 사용 사례를 자세히 설명합니다. 산은 금융 및 전자 상거래 애플리케이션에 적합한 데이터 무결성 및 일관성을 우선시하는 반면 Base는 가용성 및

PHP 보안 파일 업로드 : 파일 관련 취약점 방지.PHP 보안 파일 업로드 : 파일 관련 취약점 방지.Mar 26, 2025 pm 04:18 PM

이 기사는 코드 주입과 같은 취약점을 방지하기 위해 PHP 파일 업로드 보안에 대해 설명합니다. 파일 유형 유효성 검증, 보안 저장 및 오류 처리에 중점을 두어 응용 프로그램 보안을 향상시킵니다.

PHP 입력 유효성 검증 : 모범 사례.PHP 입력 유효성 검증 : 모범 사례.Mar 26, 2025 pm 04:17 PM

기사는 내장 함수 사용, 화이트리스트 접근 방식 및 서버 측 유효성 검사와 같은 기술에 중점을 둔 보안을 향상시키기 위해 PHP 입력 유효성 검증에 대한 모범 사례를 논의합니다.

PHP API 요율 제한 : 구현 전략.PHP API 요율 제한 : 구현 전략.Mar 26, 2025 pm 04:16 PM

이 기사는 토큰 버킷 및 누출 된 버킷과 같은 알고리즘을 포함하여 PHP에서 API 요율 제한을 구현하고 Symfony/Rate-Limiter와 같은 라이브러리 사용 전략에 대해 설명합니다. 또한 모니터링, 동적 조정 요율 제한 및 손도 다룹니다.

PHP 비밀번호 해싱 : password_hash 및 password_verify.PHP 비밀번호 해싱 : password_hash 및 password_verify.Mar 26, 2025 pm 04:15 PM

이 기사에서는 PHP에서 암호를 보호하기 위해 PHP에서 Password_hash 및 Password_Verify 사용의 이점에 대해 설명합니다. 주요 주장은 이러한 기능이 자동 소금 생성, 강한 해싱 알고리즘 및 Secur를 통해 암호 보호를 향상 시킨다는 것입니다.

OWASP Top 10 PHP : 일반적인 취약점을 설명하고 완화하십시오.OWASP Top 10 PHP : 일반적인 취약점을 설명하고 완화하십시오.Mar 26, 2025 pm 04:13 PM

이 기사는 PHP 및 완화 전략의 OWASP Top 10 취약점에 대해 설명합니다. 주요 문제에는 PHP 응용 프로그램을 모니터링하고 보호하기위한 권장 도구가 포함 된 주입, 인증 파손 및 XSS가 포함됩니다.

PHP XSS 예방 : XSS로부터 보호하는 방법.PHP XSS 예방 : XSS로부터 보호하는 방법.Mar 26, 2025 pm 04:12 PM

이 기사는 PHP의 XSS 공격을 방지하기위한 전략, 입력 소독, 출력 인코딩 및 보안 향상 라이브러리 및 프레임 워크 사용에 중점을 둔 전략에 대해 설명합니다.

PHP 인터페이스 대 추상 클래스 : 각각을 사용할 때.PHP 인터페이스 대 추상 클래스 : 각각을 사용할 때.Mar 26, 2025 pm 04:11 PM

이 기사는 각각의 사용시기에 중점을 둔 PHP의 인터페이스 및 추상 클래스 사용에 대해 설명합니다. 인터페이스는 관련없는 클래스 및 다중 상속에 적합한 구현없이 계약을 정의합니다. 초록 클래스는 일반적인 기능을 제공합니다

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

SecList

SecList

SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

안전한 시험 브라우저

안전한 시험 브라우저

안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.