PHP-FPM(FastCGI ???? ???)? ?? PHP ????? ??? ?????
PHP-FPM(FastCGI ???? ???)? ??? ? ??????? ????? ??? PHP? ?? ?????. ?? ?? ???, ?? ? ??? ?? ???? ?? PHP ????? ?? ?? ?? ??? ?????. PHP-FPM? ?? PHP ????? ??? ??? ????? ?? ????? ???? Apache ?? Nginx? ?? ? ??? ?? ???? ??? ???? ?? ?????.
1. PHP-FPM?? ??????
PHP-FPM? ???? ?? ???? ??? ?????? ??? ?? PHP ?????. ??? ???? ?? ???? PHP ??? ?? ????? ???? ?? ???? ??? ??? ???.
PHP-FPM? ?? ??:
- ???? ??: PHP ??? ???? ?? ?????.
- ?? ???: ??? ??? ??? ???? ?? PHP ????? ?? ????? ????.
- ??? ???: ?? ??? ??? ?? ?? PHP? ?? ??? ? ????.
- ?? ??: ?? ?? ??? ???? ?? ??? ??? ?????.
2. ???? PHP ????
????? PHP ????? Apache? mod_php ??? ?? ????? PHP? CGI(Common Gateway Interface) ??? ???? ?????. ?? ??? ??? ????.
- mod_php: ? ????? PHP? Apache ??? ??? ?? ?????. PHP ????? ??? ??? Apache? ??? ???? ?? ? ???? ????? ?????.
- PHP-CGI: CGI ????? PHP? ?? ????? ?????. ? ??? ?? ? ??(????? Apache ?? Nginx)? ?? ??? PHP ????? ????, ?? ?? PHP ????? ???? ??? ?????.
?? PHP ????? ??:
- ??? ??: ? ??? ??? ????? ???? ????? ?? ???? ?? ???? ?? ????? ??? ? ????.
- ??? ???: ?? ??? ??? ????? ????? ???? ???? ?? ?????? ??? ??????.
- ?? ??: ? PHP ????? ?? ??? ????? ??? ?? ?? ?? ??? ?????.
3. PHP-FPM ?? ??
PHP-FPM? ??? ???? ?? ?? ??? ???? ?? ???? ???? ??? ?????. ? ??? ?? ??? PHP ????? ???? ?? PHP-FPM? ???? ??? ??? ??? ? ??? ????(??? ?)? ?? ?????.
- ???? ??: PHP-FPM? ??? ???? ?? ???? ?? ?????. PHP-FPM ??? ????? ??? ????? ???? ?? PHP ??? ??? ??? ?? ???? ? ??? ?? ? ????? ??? ???? ?????.
- ?? ??: PHP ??? ???? PHP-FPM? ?? ?? ??? ??? ????? ?????. ?? ??? ????? ?? ??? ????? ??? ? ?? ??? ??? ???? ?????.
- ??? ???: PHP-FPM? ??? ???? ?????. ?, ????? ??? ?? ??? PHP ????? ?? ??? ? ????.
- ?? ??: PHP-FPM? ???? ???? ???? ??? ????? ???? ???? ??? ???? ?? ? ????.
4. PHP-FPM? ?? PHP ????? ?? ???
Aspect | Traditional PHP (mod_php/CGI) | PHP-FPM |
---|---|---|
Request Handling | Spawns a new process for each request (CGI) or thread (mod_php) | Uses a pool of persistent worker processes to handle multiple requests |
Resource Efficiency | Higher overhead, as each request requires a new process or thread | Lower overhead, as requests are handled by persistent processes |
Performance | Slower due to process creation for each request | Faster, as processes are reused and do not need to be recreated |
Scalability | Less scalable due to high resource consumption per request | More scalable due to efficient process pooling and dynamic scaling |
Concurrency | Limited by the number of available processes or threads | Can handle more concurrent requests with worker pools and dynamic scaling |
Configuration Flexibility | Limited flexibility for scaling or process management | Highly configurable (e.g., number of workers, request timeouts, etc.) |
Graceful Restart | Apache or CGI restarts can drop active connections | PHP-FPM supports graceful restarts without dropping connections |
Error Logging | Basic error logging | Advanced logging (e.g., slow request logging, process status) |
5. ?? PHP? ?? PHP-FPM? ??
- ??: PHP-FPM? ? ??? ?? ? ????? ???? ? ?? ????? ?? ????. ??? ????? ????? ?? ??? ????? ?? ??? ?????.
- ???: ?? ??? ?? ??? ???? ?? ???? ???? PHP-FPM? ??? ?? ???? ?? ????? ??? ? ????. ?? PHP ????? ???? ?? ??? ??? ???? ????.
- ??? ???: PHP-FPM? ??? ???? ?? ???? ? ??? ?? ? ????? ???? ??? ????? ????? ??? ???? ????.
- ???? ???: PHP-FPM? ??? ???? ???? ?? ???? ?? ?? ?? ?? ?????. ?? ?? ???? ?? ??? ???? ???? ???? ?????.
- ??? ?? ? ????: PHP-FPM? ?? ?? ?? ? ???? ?? ????? ??? ?? ?? ????? ???? ?? ??? ? ???? ??? ???.
6. PHP-FPM ?? ??
PHP-FPM? ????? ?? ?? ??? ????.
- PHP-FPM ??: ???? Linux ????? PHP-FPM? ??? ???? ?? ??? ? ????.
???/???? ??:
sudo apt-get install php-fpm
CentOS/RHEL? ??:
sudo yum install php-fpm
- PHP-FPM ??: PHP-FPM ?? ??? ????? Linux ???? /etc/php-fpm.d/ ?? /etc/php/7.x/fpm/? ????. ?? ?? ??? php-fpm.conf???.
??? ??? ? ????.
- ??? ???? ?(pm.max_children)
- ?? ?? ?? ??(request_terminate_timeout)
- ???? ?? ??(??, ??, ???)
- ? ?? ??: PHP-FPM? ???? ??? ??? PHP ?? ??? PHP-FPM? ????? ? ??(Apache ?? Nginx)? ???? ???.
-
Nginx: Nginx ???? PHP-FPM ?? ?? IP ??? ????? fastcgi_pass ???? ???? ???.
location ~ \.php$ { fastcgi_pass unix:/var/run/php/php7.x-fpm.sock; fastcgi_index index.php; include fastcgi_params; }
-
Apache: Apache??? PHP ??? PHP-FPM? ????? mod_proxy_fcgi? ???? ???.
sudo apt-get install php-fpm
- PHP-FPM ??: ??? ???? PHP-FPM ???? ?????.
sudo yum install php-fpm
7. ??
PHP-FPM(FastCGI ???? ???)? ?? PHP ????? ?? ??? ?? ? ??? ??? ?????. PHP-FPM? ??? ??? ????? ???? ?? ????? ??? ?????? ?? ??? ???? ? ????? ???? ????? ?? ?? ??? ??? ???? ??????. ? ??? ???, ? ?? ???, ? ??? ?? ?? ? ???? ??? ????? ???? ?? PHP ??????? ???? ? ??????.
?? PHP ??????? ?? ?? mod_php ?? CGI? ?? ?? PHP ????? ??? ? PHP-FPM? ???? ?? ?? ???? ?? ???? ?????.
? ??? PHP-FPM ??: ?? PHP ?????? ?? ??? ? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled
