дPHP´úÂ룬ÎÒÏàÐÅÄãÒ²ÊÇ´Ó먦Æô¹ýʲôPHP½ø³Ì£¬ÒòΪËüÊÇËæ×ÅApacheµÄÆô¶¯¶øÔËÐеģ¬PHPͨ¹ýSAPIÓëApacheÏàÁ¬¡£SAPIÔËÐÐPHP»á¾¹ýÈçϼ¸¸ö½×¶Î£º
1¡¢Ä£¿é³õʼ»¯½×¶Î(Module init)
¼´µ÷ÓÃÿ¸öÍØÕ¹Ô´ÂëÖеĵÄPHP_MINIT_FUNCTIONÖеķ½·¨³õʼ»¯Ä£¿é,½øÐÐһЩģ¿éËùÐè±äÁ¿µÄÉêÇë,ÄÚ´æ·ÖÅäµÈ¡£
2¡¢ÇëÇó³õʼ»¯½×¶Î(Request init)
¼´½ÓÊܵ½¿Í»§¶ËµÄÇëÇóºóµ÷ÓÃÿ¸öÍØÕ¹µÄPHP_RINIT_FUNCTIONÖеķ½·¨,³õʼ»¯PHP½Å±¾µÄÖ´Ðл·¾³¡£
3¡¢Ö´ÐÐPHP½Å±¾
4¡¢ÇëÇó½áÊø(Request Shutdown)
Õâʱºòµ÷ÓÃÿ¸öÍØÕ¹µÄPHP_RSHUTDOWN_FUNCTION·½·¨ÇåÀíÇëÇóÏÖ³¡,²¢ÇÒZE¿ªÊ¼»ØÊÕ±äÁ¿ºÍÄÚ´æ¡£
5¡¢¹Ø±ÕÄ£¿é(Module shutdown)
Web·þÎñÆ÷Í˳ö»òÕßÃüÁîÐнű¾Ö´ÐÐÍê±ÏÍ˳ö»áµ÷ÓÃÍØÕ¹Ô´ÂëÖеÄPHP_MSHUTDOWN_FUNCTION ·½·¨
ÄÇô¶ÔÓÚÉÏÃæËù˵µÄModule init¡¢Request init¡¢Request Shutdown¡¢Module shutdownÔËÐеĴÎÊýºÍƵÂÊÊÇÔõôÑùµÄÄØ?ÕâµÃ¿´ÔËÐÐPHPµÄSAPIÁË£º
(1)Ö±½ÓÒÔCLI/CGIģʽµ÷Óá¾µ¥½ø³ÌSAPI¡¿
CLI/CGIÊÇSPAIµÄµ¥½ø³Ìģʽ£¬PHPµÄÉúÃüÖÜÆÚÍêÈ«ÔÚÒ»¸öµ¥¶ÀµÄÇëÇóÖÐÍê³É£¬»á¾¹ýÈçϹý³Ì£º ¿ªÊ¼ - ÇëÇó¿ªÊ¼ - ÇëÇó¹Ø±Õ - ½áÊø SAPI¡£ËüµÄÉúÃüÖÜÆÚÈçÏÂͼËùʾ£º
(2)¶à½ø³ÌSAPI
µ±ApacheÆô¶¯µÄʱºò£¬»áÁ¢¼´°Ñ×Ô¼ºfork³öºÃ¼¸¸ö×Ó½ø³Ì£¬Ã¿Ò»¸ö½ø³Ì¶¼ÓÐ×Ô¼º¶ÀÁ¢µÄÄÚ´æ¿Õ¼ä£¬ Ò²¾Í´ú±íÁËÓÐ×Ô¼º¶ÀÁ¢µÄ±äÁ¿¡¢º¯ÊýµÈ¡£Ö»ÓÐÔÚApache¹Ø±Õ»òÕß½ø³Ì±»½áÊøÖ®ºó²Å»á½øÐйرս׶Σ¬ÔÚÕâÁ½¸ö½×¶ÎÖ®¼ä»áËæ×Åÿ¸öÇëÇóÖظ´ÇëÇó¿ªÊ¼-ÇëÇó¹Ø±ÕµÄ»·½Ú¡£ÉúÃüÖÜÆÚÈçÏÂͼËùʾ£º
(3)¶àÏß³ÌSAPI
¶àÏß³ÌģʽºÍ¶à½ø³ÌÖеÄij¸ö½ø³ÌÀàËÆ£¬²»Í¬µÄÊÇÔÚÕû¸ö½ø³ÌµÄÉúÃüÖÜÆÚÄڻᲢÐеÄÖظ´×Å ÇëÇó¿ªÊ¼-ÇëÇó¹Ø±ÕµÄ»·½Ú.
ÔÚÕâÖÖģʽÏ£¬Ö»ÓÐÒ»¸ö·þÎñÆ÷½ø³ÌÔÚÔËÐÐ×Å£¬µ«»áͬʱÔËÐкܶàỊ̈߳¬ÕâÑù¿ÉÒÔ¼õÉÙһЩ×ÊÔ´¿ªÏú£¬ÏòModule initºÍModule shutdown¾ÍÖ»ÐèÒªÔËÐÐÒ»±é¾ÍÐÐÁË£¬Ò»Ð©È«¾Ö±äÁ¿Ò²Ö»ÐèÒª³õʼ»¯Ò»´Î£¬ÒòΪÏ̶߳À¾ßµÄÌØÖÊ£¬Ê¹µÃ¸÷¸öÇëÇóÖ®¼ä·½±ãµÄ¹²ÏíһЩÊý¾Ý³ÉΪ¿ÉÄÜ¡£ÉúÃüÖÜÆÚÈçÏÂͼËùʾ£º
(4)Embedded(ǶÈëʽ£¬ÔÚ×Ô¼ºµÄC³ÌÐòÖе÷ÓÃZend Engine)
Embed SAPIÊÇÒ»ÖֱȽÏÌØÊâµÄsapi£¬ÈÝÐíÄãÔÚC/C++ÓïÑÔÖе÷ÓÃPHP/ZEÌṩµÄº¯Êý¡£ ²¢ÇÒÕâÖÖsapiºÍÉÏÃæµÄÈýÖÖÒ»Ñù£¬°´Module Init¡¢Request Init¡¢Rshutdown¡¢mshutdownµÄÁ÷³ÌÖ´ÐÐ×Å¡£ µ±È»£¬ÕâÖ»ÊÇÆäÖÐÒ»ÖÖÇé¿ö¡£ÒòΪÌض¨µÄÓ¦ÓÃÓÐ×Ô¼ºÌØÊâµÄÐèÇó£¬Ö»ÊÇÔÚ´¦ÀíPHP½Å±¾Õâ¸ö»·½Ú»ù±¾Ò»Ö¡£
ÕæÕýÁîemebedģʽ¶ÀÌصÄÊÇÒòΪËü¿ÉÄÜËæʱǶÈ뵽ij¸ö³ÌÐòÀïÃæÈ¥£¬ È»ºó±»µ±×÷½Å±¾µÄÒ»²¿·ÖÔÚÒ»¸öÇëÇóµÄʱºòÖ´ÐС£ ¿ØÖÆȨÔÚPHPºÍÔ³ÌÐò¼äÀ´»Ø´«µÝ¡£
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ