查看Nginx状态
location /nginx_status {stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
curl http://127.0.0.1/nginx_status
http://nginx.org/en/docs/http/ngx_http_status_module.html
输出样例:
Active connections: 3
server accepts handled requests
17737 17737 49770
Reading: 0 Writing: 1 Waiting: 2
各项解释:
Active connections: 当前 Nginx 正处理的活动连接数.
server accepts handled requests: 总共处理了 17737 个连接, 成功创建 17737 次握手(证明中间没有失败的), 总共处理了 49770 个请求.
Reading: Nginx 读取到客户端的 Header 信息数.
Writing: Nginx 返回给客户端的 Header 信息数.
Waiting: 开启 keep-alive 的情况下, 这个值等于 Active - (Reading + Writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
查看PHP-FPM状态
php-fpm.conf 中开启 pm.status_path = /statusnginx.conf 中配置:
location /status {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
访问 http://127.0.0.1/status?full 查看状态信息(我只开了一个PHP-FPM工作进程):
pool: www
process manager: static
start time: 27/Dec/2014:13:29:00 +0800
start since: 2571
accepted conn: 28
listen queue: 0
max listen queue: 0
listen queue len: 128
idle processes: 0
active processes: 1
total processes: 1
max active processes: 1
max children reached: 0
slow requests: 0
************************
pid: 1275
state: Running
start time: 27/Dec/2014:13:29:00 +0800
start since: 2571
requests: 28
request duration: 100
request method: GET
request URI: /status?full
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0
附: 下面是php-fpm.conf里的说明
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: ${prefix}/share/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
; pm.status_path = /status

PHP 다차원 어레이에서 총 요소 수를 계산하는 것은 재귀 적 또는 반복적 인 방법을 사용하여 수행 할 수 있습니다. 1. 재귀 방법은 배열을 가로 지르고 중첩 배열을 재귀 적으로 처리함으로써 계산됩니다. 2. 반복 방법은 스택을 사용하여 깊이 문제를 피하기 위해 재귀를 시뮬레이션합니다. 3. Array_Walk_Recursive 함수도 구현할 수 있지만 수동 계산이 필요합니다.

PHP에서, do-while 루프의 특성은 루프 본체가 적어도 한 번 실행되도록하고 조건에 따라 루프를 계속할지 여부를 결정하는 것입니다. 1) 조건부 점검 전에 루프 본체를 실행하며, 사용자 입력 확인 및 메뉴 시스템과 같이 작업을 적어도 한 번 수행 해야하는 시나리오에 적합합니다. 2) 그러나, do-while 루프의 구문은 초보자들 사이에서 혼란을 야기 할 수 있으며 불필요한 성능 오버 헤드를 추가 할 수 있습니다.

PHP의 효율적인 해싱 스트링은 다음 방법을 사용할 수 있습니다. 1. 빠른 해싱에 MD5 기능을 사용하지만 비밀번호 저장에는 적합하지 않습니다. 2. SHA256 기능을 사용하여 보안을 향상시킵니다. 3. Password_hash 함수를 사용하여 비밀번호를 처리하여 최고 보안과 편의성을 제공하십시오.

PHP에서 배열 슬라이딩 윈도우 구현 기능은 SlideWindow 및 SlideWindowAverage 기능으로 수행 할 수 있습니다. 1. Slide-Window 함수를 사용하여 배열을 고정 크기 서브 어레이로 분할하십시오. 2. SlideWindowAverage 함수를 사용하여 각 창의 평균 값을 계산하십시오. 3. 실시간 데이터 스트림의 경우, 비동기 처리 및 이상치 감지를 Reactphp를 사용하여 사용할 수 있습니다.

PHP의 __clone 방법은 객체 클로닝시 사용자 정의 작업을 수행하는 데 사용됩니다. 클론 키워드를 사용하여 객체를 클로닝 할 때 객체에 __ 클론 메소드가있는 경우 방법이 자동으로 호출되어 클로닝 프로세스 중에 클로닝 된 객체의 독립성을 보장하기 위해 참조 유형 속성을 재설정하는 것과 같은 클로닝 프로세스 중에 맞춤형 처리가 가능합니다.

PHP에서 GOTO 진술은 프로그램의 특정 태그로 무조건 점프하는 데 사용됩니다. 1) 복잡한 중첩 루프 또는 조건부 명세서의 처리를 단순화 할 수 있지만 2) GOTO를 사용하면 코드를 이해하고 유지하기가 어렵게 만들 수 있으며 3) 구조화 된 제어 문의 사용에 우선 순위를 부여하는 것이 좋습니다. 전반적으로, GOTO는 조심스럽게 사용해야하며 모범 사례를 따라 코드의 가독성과 유지 보수 가능성을 보장합니다.

PHP에서 내장 기능, 사용자 정의 기능 및 타사 라이브러리를 사용하여 데이터 통계를 달성 할 수 있습니다. 1) array_sum () 및 count ()와 같은 내장 함수를 사용하여 기본 통계를 수행하십시오. 2) 중앙값과 같은 복잡한 통계를 계산하기 위해 사용자 정의 기능을 작성하십시오. 3) PHP-ML 라이브러리를 사용하여 고급 통계 분석을 수행하십시오. 이러한 방법을 통해 데이터 통계를 효율적으로 수행 할 수 있습니다.

예, PHP의 익명 함수는 이름이없는 함수를 나타냅니다. 다른 함수의 매개 변수로 전달되고 함수의 리턴 값으로 전달 될 수있어 코드를보다 유연하고 효율적으로 만듭니다. 익명 기능을 사용하는 경우 범위 및 성능 문제에주의를 기울여야합니다.


핫 AI 도구

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

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

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

SublimeText3 영어 버전
권장 사항: Win 버전, 코드 프롬프트 지원!

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

mPDF
mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

Dreamweaver Mac版
시각적 웹 개발 도구