[PHPA] using PHP Accelerator - ÀÛ¼ºÀÚ : san2(at)linuxchannel.net - ÀÛ¼ºÀÏ : 2002.10.16 (PHPA 1.3.3r1 ³»¿ë Æ÷ÇÔ) 2002.08.06 (³»¿ë º¸¿Ï) 2002.08.02 (¿ÀŸ ¼öÁ¤) 2002.07.31 *ÁÖ1) ÀÌ ¹®¼­´Â Nick Lindridge ¾¾°¡ °³¹ßÇÑ ionCube PHP Accelerator¿¡ °üÇÑ ¼³Ä¡¿Í ¼³Á¤¿¡ °üÇÑ ³»¿ëÀÔ´Ï´Ù. ¶ÇÇÑ ÇÑ±Û ¹®¼­°¡ °ÅÀÇ ¾ø¾î¼­ (±×¸® ¾î·ÆÁö ¾Ê±â ¶§¹®¿¡)Ãʺ¸ÀÚ³ª óÀ½ »ç¿ëÇϽô ºÐÀ» À§Çؼ­ ÀÛ¼ºµÇ¾ú½À´Ï´Ù. *ÁÖ2) Zend optimizer¿Í °°ÀÌ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. ¸¸¾à Zend optimizer¸¦ ¼³Á¤ÇØ ³õ¾Ò´Ù¸é ¹Ýµå½Ã offÇØ ³õ¾Æ¾ß ÇÕ´Ï´Ù. *ÁÖ3) ÀÌ ¹®¼­¿¡ ´ëÇÑ ÃֽŠ³»¿ëÀº ¾Æ·¡ URL¿¡¼­ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù. http://www.linuxchannel.net/docs/php_accelerator.txt *ÁÖ4) ¹®¸Æ»ó °£È¤ °æ¾î¸¦ »ý·«Çß½À´Ï´Ù. ¾çÇØÇØÁÖ½Ã±æ ¹Ù¶ø´Ï´Ù. ============================================================= ¸ñÂ÷ 0. °³¿ä(ºü¸¥ ¼³Ä¡) 1. PHP Accelerator? 2. PHP Accelerator ¼³Ä¡¿Í ¼³Á¤ 2.1 PHP Accelerator ´Ù¿î·Îµå 2.2 PHP Accelerator ¼³Ä¡ 2.3 PHP Accelerator ¼³Á¤ 3. ÀÛµ¿È®ÀÎ 4. °£´ÜÇÑ ¼Óµµ Å×½ºÆ® 5. °ü¸®ÀÚ¿ë À¯Æ¿¸®Æ¼ PHPACA 6. ±âŸ Á¤º¸ 7. Èıâ ============================================================= 0. °³¿ä(ºü¸¥ ¼³Ä¡) 1) ´Ù¿î·Îµå http://www.php-accelerator.co.uk/download.php ÆÄÀÏÀ̸§ Çü½Ä: php_accelerator-<¹öÀü>__<¿î¿µÃ¼Á¦>.tgz php_accelerator-<¹öÀü>__.tgz(¸®´ª½º °æ¿ì) 2) ¾ÐÃàÇØÁ¦ ¹× º¹»ç # cp php_accelerator_1.3.2.so /usr/local/lib # cp phpa_cache_admin /usr/local/bin 3) ¼³Á¤(1.3.2ºÎÅÍ key µî·ÏÇÊ¿ä ¾øÀ½) # phpini='/usr/local/lib/php.ini' # echo >> $phpini # echo "zend_extension = /usr/local/lib/php_accelerator_1.3.2.so" >> $phpini # cat CONFIGURATION | egrep "^(phpa[^=]+=|;)" \ | grep -v "phpa\.phpa" >> $phpini 4) ¾ÆÆÄÄ¡ Àç½ÃÀÛ # apachectl restart 5) È®ÀÎ phpinfo(); 1. PHP Accelerator? ionCube PHP Accelerator(ÀÌÇÏ 'PHPA')´Â Zend Accelerator(Zend cache)¿Í °°ÀÌ PHP ij½Ã ¿ªÇÒÀ» Á¦°øÇÏ´Â 'Zend engine extension' ÁßÀÇ Çϳª·Î½á Nick Lindridge(¿µ±¹ ºÐÀεí) ¾¾°¡ °³¹ßÇß½À´Ï´Ù. PHPA´Â PHP ½ºÅ©¸³Æ®¸¦ Ŭ¶óÀ̾ðÆ® ¿äû¿¡ ÀÇÇؼ­ ¼­¹ö¿¡¼­ Çѹø ÀÐÇôÁö¸é, ÀÏÁ¤ ½Ã°£µ¿¾È ij½Ã ¸Þ¸ð¸®¿¡ ÀúÀåµÇ°í, ±× ÀÌÈÄ ¿äûÀº ½ÇÁ¦·Î ¸Þ¸ð¸®¿¡ ÀÖ´Â Á¤º¸¸¦ Çؼ®ÇϹǷΠHDD¿¡¼­ Àд °Íº¸´Ù ÈξÀ ºü¸£°Ô ÀÛµ¿ÇÕ´Ï´Ù. ÇÊÀÚ´Â ¿¹Àü¿¡ PHPA¸¦ ºÙ¿©¼­ ¼îÇθôÀ» ÇÁ·Î±×·¥ÇÑ ÀûÀÌ ÀÖ¾ú´Âµ¥ »ó´çÈ÷ ¸¸Á·ÇÒ ¸¸ÇÑ ¼º´ÉÀ» ³»´õ±º¿ä. ¿¹¸¦ µé¾î, PHPA ¾øÀÌ ¼­¹ö°¡ PHP ½ºÅ©¸³Æ®¸¦ Çؼ®ÇÏ´Â ½Ã°£ÀÌ 0.5ÃÊ °É·È´Ù¸é PHPA¸¦ »ç¿ëÇÒ °æ¿ì´Â 0.08ÃÊ Á¤µµ °É¸®´õ±º¿ä. ¹°·Ð °´°üÀûÀÎ ¼Óµµ ÃøÁ¤(±âÁØ)Àº ¾Æ´ÏÁö¸¸, PHPA¸¦ »ç¿ëÇÒ °æ¿ì ±× Àüº¸´Ù »ó´çÈ÷ ³´Àº ¼º´ÉÀ» ³½´Ù´Â °ÍÀ» Áö·¹ ÁüÀÛÇÒ ¼ö ÀÖ½À´Ï´Ù. Zend Accelerator¸¦ »ç¿ëÇØ º¸½Å ºÐÀÌ ÀÖ´Ù¸é ¾î´À Á¤µµ ¼º´ÉÀ» ³»´ÂÁö ÁüÀÛÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù. - http://www.php-accelerator.co.uk/performance.php ¾ÕÀÇ URL¿¡¼­ ±× ¼º´ÉÀ» ºñ±³ÇØ º¸¸é Zend Accelerator(Zend cache)¿¡ °ÅÀÇ ±ÙÁ¢ÇÑ ¼öÄ¡¸¦ ³»°í ÀÖÀ½À» ¾Ë ¼ö ÀÖ½À´Ï´Ù. ¼³Ä¡´Â ±×¸® ¾î·ÆÁö ¾ÊÀº ÆíÀÔ´Ï´Ù. Áï PHP³ª ¾ÆÆÄÄ¡¸¦ ÄÄÆÄÀÏÇÏ´Â °úÁ¤ Áß¿¡¼­ ¼³Ä¡ÇÏ´Â °ÍÀÌ ¾Æ´Ï¶ó, ¾ÆÆÄÄ¡-PHP°¡ ¼³Ä¡µÈ »óÅ¿¡¼­ 'zend extension'À» ÁöÁ¤ÇØ ÁÖ¸é ±×¸¸ÀÔ´Ï´Ù. Áï PHPA ȨÆäÀÌÁö¿¡¼­ Á¦°øÇÏ´Â ÆÄÀÏÀº ¹ÙÀ̳ʸ® ÆÄÀÏ·Î½á ¾ÆÁ÷ ¼Ò½º´Â °ø°³µÇÁö ¾Ê¾Ò±â ¶§¹®¿¡ ÄÄÆÄÀÏÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. 'PHPA is free' Á»´õ ÀÚ¼¼ÇÑ ³»¿ëÀ» ¾Ë°í ÀÖ´Ù¸é ´ÙÀ½ÀÇ PHPA ȨÆäÀÌÁö¸¦ ¹æ¹® Çϼ¼¿ä. - http://www.php-accelerator.co.uk/ PHPA¿Í °°ÀÌ PHP cache ±â´ÉÀÌ ÀÖ´Â ´Ù¸¥ ÇÁ·Î±×·¥Àº ´ÙÀ½°ú °°½À´Ï´Ù. - PHP Accelerator (Nick Lindridge) (freeware) - Alternative PHP Cache (Community Connect) (freeware) - AfterBurner (Bware Technologies) (freeware) - Zend Accelerator (Zend) (commercial) - ±âŸ(...) Âü°í·Î ÀÌ ¹®¼­´Â ´ÙÀ½ÀÇ ¹®¼­¸¦ ±âÁØÀ¸·Î ÀÛ¼ºµÇ¾ú½À´Ï´Ù. - http://www.php-accelerator.co.uk/releases/x.x.x/INSTALL - http://www.php-accelerator.co.uk/releases/x.x.x/CONFIGURATION - http://www.php-accelerator.co.uk/faq.php 2. PHP Accelerator ¼³Ä¡¿Í ¼³Á¤ 2.1 PHP Accelerator ´Ù¿î·Îµå ´ÙÀ½ÀÇ ½ÎÀÌÆ®¿¡¼­ PHPA¸¦ ´Ù¿î·Îµå ÇÕ´Ï´Ù. Âü°í·Î 2002.08.03(GMT+9) ÇöÀç, ¸®´ª½º ¹öÀüÀº 1.3.2 ¹öÀü±îÁö ³ª¿ÔÀ¸¸ç, ¸®´ª½º ÀÌ ¿Ü¿¡ BSDi, FreeBSD, OpenBSD(Intel), Solaris(Intel), Solaris(Sparc), Tru64 Unix(4.0G, 5.0, 5.1) µîÀÇ ¿î¿µÃ¼Á¦¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. - http://www.php-accelerator.co.uk/download.php ÆÄÀÏÀ̸§ Çü½Ä: - php_accelerator-<¹öÀü>__<¿î¿µÃ¼Á¦>.tgz - php_accelerator-<¹öÀü>__.tgz(¸®´ª½º °æ¿ì) ¸®´ª½ºÀÇ °æ¿ì, glibc(GNU libc) ¹öÀü º°·Î ÆÄÀÏÀÌ ´Ù¸£¹Ç·Î ¹Ýµå½Ã ¼³Ä¡ÇÏ·Á´Â ¼­¹öÀÇ glibc ¹öÀüÀ» È®ÀÎÇØ¾ß ÇÕ´Ï´Ù. ·¹µåÇÞ 6.x(glibc-2.3.1), ·¹µåÇÞ 7.0(glibc-2.2), ·¹µåÇÞ 7.2(glibc-2.2.4) À̸ç, È®½ÇÇÏ°Ô È®ÀÎÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ ¸í·ÉÀ» ³»·Á¼­ È®ÀÎÇϵµ·Ï ÇÕ´Ï´Ù. # ldd --version ldd (GNU libc) 2.2.4 <-- È®ÀÎ »çÇ× Copyright (C) 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper. ¸¸¾à °¡Àå ÃÖ±ÙÀÇ PHPA ¹öÀüÀÌ 1.3.2ÀÌ°í, linux glibc ¹öÀüÀÌ 2.2.4ÀÌ°í, ÇöÀç ¼­¹ö¿¡¼­ »ç¿ëÇÏ´Â PHP ¹öÀüÀÌ 4.2.2À̸é, 'php_accelerator-1.3.2_php-4.2.2_linux-glibc2.2.4.tgz' ÆÄÀÏÀ» ´Ù¿î·ÎµåÇÏ¸é µË´Ï´Ù. <¾÷µ¥ÀÌÆ® : 2002.10.16> 1.3.3À¸·Î ¹öÀüÀ¸·Î ¿Ã¶ó°¡¸é¼­ ¸®´ª½ºÀÇ °æ¿ì´Â ±âÁ¸ÀÇ glibc-2.2, glibc-2.2.4 À¸·Î ºÐ·ùµÇ¾ú´ø PHPA ¹öÀüÀÌ ¾ø¾îÁ³½À´Ï´Ù. ¸ðµÎ 'glibc2'¶ó´Â À̸§À¸·Î ÅëÇյǾî ÀÖÀ¸¸ç ½ÇÁ¦·Î´Â glibc-2.1.3 ¹öÀüÀÌÁö¸¸, glic-2.2.x ¹öÀü¿¡¼­µµ Àß ÀÛµ¿ÇÕ´Ï´Ù. 2.2 PHP Accelerator ¼³Ä¡ ´Ù¿î·ÎµåÇÑ ÆÄÀÏÀ» ¾ÐÃà ÇØÁ¦ÇÏ¸é ´ÙÀ½°ú °°Àº ÆÄÀÏÀ» º¼ ¼ö ÀÖ½À´Ï´Ù. CONFIGURATION openbsd_notes phpapowby.gif INSTALL php_accelerator_1.3.2.so powered-by-phpa.gif bsdi_notes phpa_acc_by.gif release_notes freebsd_notes phpa_cache_admin solaris_notes Á¦ÀÏ Áß¿äÇÑ ÆÄÀÏÀº 'php_accelerator_1.3.2.so'À̸ç, CONFIGURATION ÆÄÀÏÀº ¼³Á¤ÇÒ ³»¿ë¿¡ °üÇÑ ³»¿ëÀ» ´ã°í ÀÖÀ¸¹Ç·Î ¹Ýµå½Ã Àо¾Æ¾ß ÇÕ´Ï´Ù. ±× ¿Ü INSTALL ÆÄÀÏÀº ¼³Ä¡¿¡ °üÇÑ ³»¿ëÀ» ´ã°í ÀÖÀ¸¸ç, phpa_cache_admin ÆÄÀÏÀº °ü¸®ÀÚ¿ë À¯Æ¿¸®Æ¼ÀÔ´Ï´Ù. ¼³Ä¡ ¼ø¼­ : 1. php_accelerator_1.3.2.so ÆÄÀÏÀ» Àû´çÇÑ À§Ä¡¿¡ º¹»ç ¶Ç´Â ¿Å°Ü³õ´Â´Ù. 2. phpa_cache_admin ÆÄÀÏÀ» /usr/local/bin µð·ºÅ丮 Á¤µµ¿¡ º¹»çÇÑ´Ù. 3. php.ini ÆÄÀÏÀ» ¿­¾î¼­ ¼³Á¤ÇÑ´Ù. ¼³Ä¡ ¿¹(¾ÆÁÖ °£´ÜÇÔ) : # cp php_accelerator_1.3.2.so /usr/local/lib/ # ln -s php_accelerator_1.3.2.so php_accelerator.so (ÇÊ¿äÇÏ´Ù¸é) # cp phpa_cache_admin /usr/local/bin 2.3 PHP Accelerator ¼³Á¤ 'php_accelerator_.so' ÆÄÀÏÀ» Àû´çÇÑ À§Ä¡¿¡ º¹»çÇßÀ¸¸é php.ini ÆÄÀÏÀ» ¿­¾î¼­ ÆíÁýÇØ¾ß ÇÕ´Ï´Ù. php.ini ÆÄÀÏÀÌ '/usr/local/lib/php.ini'¿¡ ÀÖ´Ù´Â °¡Á¤ÀÔ´Ï´Ù. ÀÏ´Ü php.ini ÆÄÀÏ¿¡ zend_extension Ç׸ñÀ» Ãß°¡ÇØ¾ß Çϴµ¥ °£´ÜÇÏ°Ô ´ÙÀ½°ú °°ÀÌ cat ¸í·ÉÀ» »ç¿ëÇؼ­ Ãß°¡Çصµ »ó°ü¾ø½À´Ï´Ù óÀ½ ¼³Ä¡ÇÒ °æ¿ì : # phpini='/usr/local/lib/php.ini' <-- ±æ°Ô ¾²±â ±ÍÂú¾Æ¼­... # # cat << EOF >> $phpini > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;;; PHP_Accelerator Configuration ;;; > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > zend_extension = /usr/local/lib/php_accelerator_1.3.2.so > > EOF # óÀ½ ¼³Ä¡ÇÒ °æ¿ì¿¡´Â php.ini ÆÄÀÏ¿¡ Ãß°¡ÇÒ »çÇ×ÀÌ ¸¹±â ¶§¹®¿¡ ´ÙÀ½°ú °°ÀÌ CONFIGURATION ÆÄÀÏÀ» ÀÌ¿ëÇؼ­ ÇÊ¿äÇÑ ¼³Á¤ ³»¿ëÀ» ÀÏ´Ü Ãß°¡ÇØ ³õ°í ÆíÁýÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù. óÀ½ ¼³Ä¡ÇÒ °æ¿ì : [¹æ¹ý1] ¼³¸í ÁÖ¼® ¾øÀÌ ´Ü¼øÇÏ°Ô ¼³Á¤ ³»¿ë¸¸ Ãß°¡ÇÒ °æ¿ì # cat CONFIGURATION | egrep "^phpa[^=]+=" \ | grep -v "phpa\.phpa" >> /usr/local/lib/php.ini [¹æ¹ý2] ¼³¸í ÁÖ¼®À» Æ÷ÇÔÇÒ °æ¿ì # cat CONFIGURATION | egrep "^(phpa[^=]+=|;)" \ | grep -v "phpa\.phpa" >> /usr/local/lib/php.ini [¹æ¹ý3] Á»´õ ¼¼·ÃµÇ°Ô(?) - (½©·Î ÀÛ¼º) # sh phpa_config ----------------- phpa_config ------------------------ #!/bin/sh phpini='/usr/local/lib/php.ini' CONFIGURATION='/any/path/to/CONFIGURATION' phpa_body_config=`cat "$CONFIGURATION" 2>/dev/null \ | egrep "^(phpa[^=]+=|;)" | grep -v "phpa\.phpa"` ## backup php.ini cp -f $phpini $phpini.bak #cat << EOF >> $phpini # #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #;;; PHP_Accelerator Configuration ;;; #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # #zend_extension = /usr/local/lib/php_accelerator_1.3.2.so #EOF IFS=' ' ## string 'key' old PHPA version, but compatible ## echo >> $php.ini for line in $phpa_body_config ; do if [ X$(echo "$line" | grep "^phpa") != "X" ] ; then line=`echo "$line" | sed \ -e "s/^phpa\.ignore_/;phpa.ignore_/" \ -e "s/^phpa\.shm_ignore_/;phpa.shm_ignore_/"` echo -e ";\n$line\n" >> $phpini else echo "$line" >> $phpini fi done exit 0 ----------------- cut ------------------------ ±× ¿Ü, ±×³É php.ini ÆÄÀÏ¿¡¼­ CONFIGURATION ÆÄÀÏÀ» ºÒ·¯¿Í¼­ ÆíÁýÇÏ¸é ±×¸¸ÀÔ´Ï´Ù. ¾÷±×·¹À̵åÇÏ´Â °æ¿ì´Â release_notes ÆÄÀÏÀ» Àо°í Ãß°¡µÈ ¼³Á¤ ³»¿ëÀ̳ª º¯°æµÈ Á¡À» php.ini ÆÄÀÏ¿¡ Àû¿ëÇØ¾ß ÇÕ´Ï´Ù. Âü°í·Î 1.3.2·Î ¾÷±×·¹ÀÌµå µÇ¸é¼­, phpa.shm_lock_threshold0 = 10 phpa.shm_lock_threshold1 = 10 <¾÷µ¥ÀÌÆ® : 2002.10.16> PHPA 1.3.3¿¡¼­´Â phpa.enable_php_memory_bug_workaround = 0 Áö½ÃÀÚ°¡ Ãß°¡µÇ¾ú½À´Ï´Ù. ÀÌ Áö½ÃÀÚ´Â PHP¸¦ ÄÄÆÄÀÏÇÒ ¶§ --enable-memory-limit ¿É¼ÇÀ» ÁÖ¾î ÄÄÆÄÀÏÇß´Ù¸é À§ÀÇ Áö½ÃÀÚ¿¡ '1'·Î ¼³Á¤Çϵµ·Ï Çϼ¼¿ä. µÎ °³ÀÇ ¼³Á¤ ³»¿ëÀÌ Ãß°¡µÇ¾úÀ¸¸ç, ¶ÇÇÑ 'ionCube PHP Encoder'·Î ÀÎÄÚµùµÈ PHP ÆÄÀÏÀ» 'ionCube decoder'¸¦ ÀÌ¿ëÇÏ¿© µðÄÚµùÇÑ ´ÙÀ½ PHPA¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. zend_extension = /usr/local/lib/php_decoder_1.0.2.so zend_extension = /usr/local/lib/php_accelerator_1.3.2.so 'ionCube decoder'¿¡ °üÇÑ ³»¿ëÀº http://www.ioncube.com/¸¦ ¹æ¹®ÇØ º¸¼¼¿ä. Âü°í·Î PHP Encoder´Â 1.4 ¹öÀüºÎÅÍ Áö¿øÇÑ´Ù°í Çϳ׿ä.. ¹«¾ùº¸´Ù 1.3.2·Î ¾÷±×·¹ÀÌµå µÇ¸é¼­ 'activation keys' ¼³Á¤ÀÌ ¾ø¾îÁ³½À´Ï´Ù. PHPA 1.2.0 ÀÌ»ó ¹öÀüºÎÅÍ 1.3.1±îÁö´Â PHPA key¸¦ ¼³Á¤ÇØÁà¾ß ÇÕ´Ï´Ù. ÀÌ Å°´Â Ưº°ÇÏ°Ô ¾î¶² 'ÅëÁ¦'ÀÇ Àǹ̸¦ °®´Â °ÍÀº ¾Æ´Ï°í, °³¹ßÀÚ Nick Lindridge ¾¾¿¡ ÀÇÇÏ¸é ¾î´À ¾î´À ½ÎÀÌÆ®¿¡¼­ PHPA¸¦ »ç¿ëÇÏ´ÂÁö ¾Ë¾Æº¸±â À§Çؼ­ °í¾ÈÇÑ ¹æ¹ý À̶ó°í Çϳ׿ä. PHPA 1.1p1¿¡¼­ 1.2·Î ³Ñ¾î¿À¸é¼­ key ¼³Á¤ ºÎºÐÀÌ Ãß°¡µÇ¾î¼­ »ó´çÈ÷ Ȳ´çÇߴµ¥, Àú ¿Ü¿¡ ¿©·¯ »ç¶÷µéµµ ´Ù °°Àº »ý°¢ÀÎ°Í °°´õ±º¿ä. ´ÙÇàÀÌ 1.3.2ºÎÅÍ´Â »ç¶óÁ³Áö¸¸..... ´ÙÀ½ÀÇ ½ÎÀÌÆ®¸¦ ¹æ¹®Çϸé 1.2·Î ³Ñ¾î¿À¸é¼­ ÀÌ Å° ¶§¹®¿¡ °³¹ßÀÚ°¡ °ï¿åÀ» ´çÇÏ´Â(?) ³»¿ëÀ» º¼ ¼ö ÀÖ½À´Ï´Ù. - http://www.freelists.org/archives/phpa/01-2002/threads.html ±×¸®°í ¸¶Ä§³» 1.3.2¸¦ ¸±¸®ÁîµÇ±âÀü, 2002³â 6¿ù¿¡ °áÁ¤À» Çß±º¿ä(^.^) - http://www.freelists.org/archives/phpa/06-2002/msg00060.html ´ÙÀ½ÀÇ PHPA ¼³Á¤ Ç׸ñ(Áö½ÃÀÚ)Àº ´Ù¸¥ PHP ¼³Á¤ Áö½ÃÀÚ°ú ¶È°°Àº Çü½ÄÀ¸·Î httpd.conf, .htaccess(¿¹) µîÀÇ ¼³Á¤ ÆÄÀÏ¿¡ °¢°¢ ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. Áï ³ª ÄÜÅ×ÀÌ³Ê ¾È¿¡ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù´Â ÀǹÌÀÔ´Ï´Ù. # php.ini, httpd.conf php_value phpa.tweaks <0|1> # php.ini, httpd.conf php_value phpa <0|1> # php.ini, httpd.conf, .htaccess php_value phpa.cache_dir # php.ini, httpd.conf, .htaccess php_value phpa.shm_ttl # php.ini, httpd.conf php_value phpa.ignore_files # php.ini, httpd.conf php_value phpa.ignore_dirs # php.ini, httpd.conf php_value phpa.shm_ignore_files # php.ini, httpd.conf php_value phpa.shm_ignore_dirs ¿¹¸¦ µé¾î, ------ httpd.conf(¿¹) -------------------------------------- php_value phpa.cache_dir /tmp/site1_phpa_cache php_value phpa.shm_ttl 6h php_value phpa 0 ServerName www.linux.ac.kr php_value phpa 0 ... ServerName www.otherhost.com php_value phpa.cache_dir /tmp/phpa/otherhost ... ------------------------------------------------------------ ------- DocumentRoot/nocache/.htaccess(¿¹) ------------------------- php_value phpa 0 ------------------------------------------------------------ ------- DocumentRoot/any/path/to/.htaccess(¿¹) ------------- php_value phpa.shm_ttl 3h ------------------------------------------------------------ PHPA ¿Ü¿¡ ´Ù¸¥ PHP Áö½ÃÀÚ ¼³Á¤Àº ´ÙÀ½ URLÀ» Âü°íÇÏ½Ã±æ ¹Ù¶ø´Ï´Ù. - http://www.php.net/manual/en/function.ini-set.php <ÁÖÀÇ> httpd.conf ¶Ç´Â .htaccess ÆÄÀÏ¿¡ Àû¿ëÇÒ °æ¿ì, On --> 1 Off --> 0 on/off·Î Á÷Á¢ ¼³Á¤ÇÒ °æ¿ì Àß ÀÛµ¿ÇÏÁö ¾ÊÀº °æ¿ì°¡ ÀÖÀ¸¹Ç·Î ÀÌ¿Í °°ÀÌ on/off¿¡ °üÇÑ ¼³Á¤Àº °¡´ÉÇÑ 0(off) ¶Ç´Â 1(on)·Î ¼³Á¤Çϵµ·Ï Çϼ¼¿ä ¾Õ¿¡¼­ ¼Ò°³ÇÏÁö ¾ÊÀº ±âŸ PHPA ¼³Á¤ Áö½ÃÀÚ´Â ´Ù¸§°ú °°ÀÌ PHP ½ºÅ©¸³Æ®·Î ÇÁ·Î±×·¥ÇÏ¿© È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù. -- phpa-config-debug.php ------------------------------------ $v) { if($name) $var = "${name}[\"$k\"]"; else $var = $k; if(!$constants) $var = '$'.$var; echo "$var = $v
\n"; if(is_array($v) && sizeof($v)>0) { echo "
    \n"; _var_dump($v,$var,1); echo "
\n"; } } } $ini = ini_get_all(); _var_dump($ini,0,1); ?> -------------------------------------------------------------- -- Ãâ·Â °á°ú(¿¹) --------------------------------------------- phpa = Array phpa["global_value"] = 1 phpa["local_value"] = 1 phpa["access"] = 7 phpa.cache_dir = Array phpa.cache_dir["global_value"] = /tmp/phpa phpa.cache_dir["local_value"] = /tmp/phpa phpa.cache_dir["access"] = 7 phpa.cache_file_prune_period = Array phpa.cache_file_prune_period["global_value"] = 60s phpa.cache_file_prune_period["local_value"] = 60s phpa.cache_file_prune_period["access"] = 1 -------------------------------------------------------------- ´«¿©°Ü º¼ Ç׸ñÀº °¢ ¼³Á¤ Áö½ÃÀÚÀÇ ¼³Á¤±ÇÇÑÀÎ ["access"] °ªÀÔ´Ï´Ù. ¿¹¸¦ µé¾î phpa´Â 7, phpa.cache_dir´Â 7 phpa.cache_file_prune_period´Â 1 ÀÔ´Ï´Ù. - http://www.php.net/manual/en/function.ini-set.php À§ÀÇ ½ÎÀÌÆ®¸¦ ¹æ¹®Çϸé ÀÌ »ó¼ö °ª(ºñÆ®)¿¡ ´ëÇÑ ¼³¸íÀÌ ÀÖ½À´Ï´Ù. Áï, - »ó¼ö°ª 1 : user script ÆÄÀÏ(xxx.php)¿¡ ini_set()ÇÔ¼ö·Î ¼³Á¤°¡´É - »ó¼ö°ª 2 : .htaccess, httpd.conf(vhost) - »ó¼ö°ª 4 : php.ini, httpd.conf(not include vhost) - »ó¼ö°ª 7 : anywhere ÀÔ´Ï´Ù. °¢ »ó¼ö°ªÀº À̵éÀÇ Á¶ÇÕ´Ï´Ù. ¿¹¸¦µé¾î, phpa.cache_dir Áö½ÃÀÚ´Â Á¢±Ù±ÇÇÑÀÌ 7À̹ǷΠphp.ini, httpd.conf, .htaccess, xxx.php ÆÄÀÏ ¸ðµÎ¿¡ ¼³Á¤ °¡´ÉÇÏ´Ù´Â ÀǹÌÀÔ´Ï´Ù. ±×·³ php.ini ÆÄÀÏÀ» ¿­¾î¼­ ¼³Á¤ ³»¿ëÀ» Ãß°¡Çϰųª ÆíÁýÇØ º¾½Ã´Ù. ¹öÀü¸¶´Ù ¼³Á¤ ³»¿ëÀÌ ´Ù¸¦ ¼ö ÀÖÀ¸¹Ç·Î, ¹Ýµå½Ã ´Ù¿î·ÎµåÇÑ ÆÄÀÏ¿¡ ÇÔ²² ÷ºÎµÈ CONFIGURATION ÆÄÀÏÀÇ ³»¿ëÀ» Àû¿ëÇØ¾ß ÇÕ´Ï´Ù. ´ÙÀ½ÀÇ ³»¿ëÀº PHPA 1.3.2(1.3.3Æ÷ÇÔ)¹öÀüÀÔ´Ï´Ù. Âü°í·Î php.ini ÆÄÀÏ¿¡¼­ ÁÖ¼®Àº ';'ÀÔ´Ï´Ù. ------------------------------------------------------------ ; <ÁÖÀÇ> ; ÁÖÀÇÇÒ Á¡Àº Zend optimizer¿Í ÇÔ²² ¼³Á¤ÇÒ ¼ö ¾ø½À´Ï´Ù. ; ; zend_extension¿¡ PHPA *.so ÆÄÀÏÀ» ÁöÁ¤ÇÕ´Ï´Ù. ; zend_extension = /usr/local/lib/php_accelerator_1.3.2.so ; PHP Accelerator ±â´ÉÀ» enable(on) ¶Ç´Â disable(off) ¼³Á¤ ; ±âº»°ªÀº 'on' ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7, ±×·¯³ª ini_set('phpa',1)´Â ÀÛµ¿ÇÏÁö ¾ÊÀ½ ; phpa = on ; ÄÄÆÄÀÏµÈ Accelerator ÄÚµåÀÇ ÃÖÀûÈ­ ¿É¼ÇÀ¸·Î ±âº»°ªÀº 'on'. ; ¼º´É Çâ»ó¿¡ µµ¿òÀ» ÁֹǷΠ'on'À¸·Î ¼³Á¤Çϼ¼¿ä. ÄÚµå Å©±â¸¦ ÁÙ¿©ÁÖ°í ; ¼Óµµ¸¦ ¿Ã·ÁÁÝ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.tweaks = on ; PHPA 1.3.3¿¡ ÇØ´çµÇ´Â ¼³Á¤Áö½ÃÀÚÀÔ´Ï´Ù. ; PHP¸¦ ÄÄÆÄÀÏÇÒ¶§ --enable-memory-limit ¿É¼ÇÀ» ÁÖ¾î ÄÄÆÄÀÏÇß´Ù¸é ; ÀÌ ÀÌÁöÀÚ ¼³Á¤À» On(1)·Î ¼³Á¤Çϵµ·Ï Çϼ¼¿ä. ; ±âº»°ªÀº '0'ÀÔ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.enable_php_memory_bug_workaround = 0 ; ij½ÃµÈ ÆÄÀÏÀ» ÀúÀåÇÒ µð·ºÅ丮¸¦ Àý´ë °æ·Î·Î ¼³Á¤ÇÕ´Ï´Ù. ; ±âº»°ªÀº /tmp À̸ç, ij½ÃµÈ ÆÄÀÏÀº 'phpa_xxxx'À̶ó´Â À̸§À» °¡Áý´Ï´Ù. ; ; <ÁÖÀÇ> ; 1. RAM ±â¹Ý ÆÄÀÏ ½Ã½ºÅÛ¿¡ ¼³Á¤ÇÏÁö ¾Êµµ·Ï ÇÕ´Ï´Ù.(T.T) ; 2. NFS ÆÄÀÏ ½Ã½ºÅÛ¿¡ ¼³Á¤ÇÏÁö ¾Êµµ·Ï ÇÕ´Ï´Ù. ; ; ; shm ij½Ã°¡ disable µÇÁö ¾Ê´Â ÀÌ»ó, ij½Ã ÆÄÀÏÀº »õ·Î »ý¼ºµÇ°Å³ª, ; º¯°æµÈ ÆÄÀÏÀÌ Ä³½ÃµÇ¸é ij½Ã ÆÄÀÏÀº ÀÌ µð·ºÅ丮¿¡ Á¸ÀçÇÕ´Ï´Ù. ; ÀϺΠRAM ±â¹Ý ÆÄÀÏ ½Ã½ºÅÛÀº ¹ö±×¿Í ¸Þ¸ð¸® ¸ÅÇÎ ÆÄÀÏ¿¡ ¹®Á¦°¡ ÀÖ±â ; ¶§¹®¿¡ °¡´ÉÇÑ µð½ºÅ© ±â¹Ý ÆÄÀϽýºÅÛ¿¡ ¼³Á¤Çϵµ·Ï Çϼ¼¿ä. ; ; ½ÇÁ¦·Î ÇÊÀÚ°¡ 1.1p1 ¹öÀüÀ» RAM disk¿¡ ¿Ã·Áº»ÀûÀÌ Àִµ¥ Á»Àüº¸´Ù ; Å©°Ô ³´Àº ¼º´ÉÀ» ³»ÁöÁö ¾Ê´õ±º¿ä. ; ; <±ÇÀå> ; /tmp/phpa µð·ºÅ丮¸¦ ¸¸µé°í /tmp/phpa µð·ºÅ丮 Æ۹̼ÇÀ» ; ÃÖ¼ÒÇÑ nobody(¾ÆÆÄÄ¡ ½ÇÇà À¯Àú)°¡ ¾µ ¼ö ÀÖµµ·Ï Á¶Á¤Çϸé ; ÈξÀ ±ò²û ÇÏ°Ú±º¿ä. ; # mkdir /tmp/phpa ; # chown nobody.nobody /tmp/phpa ; ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; phpa.cache_dir = /tmp ; 8Áø¼ö·Î ij½Ã ÆÄÀÏÀÇ ÆÛ¹Ì¼Ç ¼³Á¤, ±âº»°ªÀº 400(-r--------). ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.file_perms = 400 ; PHPA¿¡¼­ ¹«½ÃÇÒ ÆÄÀÏÀ» ÄÞ¸¶(,)·Î ±¸ºÐÇÏ¿© ¼³Á¤ÇÕ´Ï´Ù. ; ¿©±â¿¡ ¼³Á¤µÈ ÆÄÀÏÀº PHPA°¡ ij½ÃÇÏÁö ¾Ê±â ¶§¹®¿¡ PHP Äڵ尡 ÀÚÁÖ ; ¹Ù²î°Å³ª ij½ÃÇÒ ÇÊ¿ä°¡ ¾ø´Â ÆÄÀÏÀ» ±× ´ë»óÀ¸·Î ÇÕ´Ï´Ù. ; ; ¼³Á¤ÇÑ ÆÄÀÏÀº ½Ã½ºÅÛ Àý´ë °æ·Î³ª URLÀÌ ¾Æ´Ñ URIÁß¿¡¼­ ÀϺκаú ; ÀÏÄ¡Çϸé PHPA¿¡¼­ ij½ÃÇÏÁö ¾Ê½À´Ï´Ù. ; (ÇÊÀÚ´Â ¸ðµÎ ij½ÃÇϱ⸦ ¿øÇϱ⠶§¹®¿¡ ÁÖ¼®À» Ãß°¡ÇßÀ» »Ó) ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; ;phpa.ignore_files = "/index.php,/a/help.php" ; PHPA¿¡¼­ ¹«½ÃÇÒ µð·ºÅ丮¸¦ ¼³Á¤ÇÕ´Ï´Ù. Á¦ÀÏ µÚ¿¡ '/'Ãß°¡. ; »ç¿ë¹ýÀº phpa.ignore_files°ú µ¿ÀÏÇÕ´Ï´Ù. ; ij½ÃµÈ ÆÄÀÏ°ú ij½ÃµÇÁö ¾ÊÀº ÆÄÀÏ¿¡ ´ëÇؼ­ ¼Óµµ¸¦ ºñ±³ÇÏ°íÀÚ ÇÑ´Ù¸é, ; ƯÁ¤ µð·ºÅ丮·Î ÁöÁ¤ÇÏ°í °°Àº ÆÄÀÏÀ» °¢°¢ º¹»çÇØ ³õ°í Å×½ºÆ®Çϸé ; µË´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; phpa.ignore_dirs = "/temp/,/tmp/,/nocache/" ; ij½Ã µð·ºÅ丮¿¡ À§Ä¡ÇÑ '/tmp/.prunded' ÆÄÀÏÀÇ °»½Å ÁÖ±â(period) ¼³Á¤. ; 'pruning'Àº ij½Ã µð·ºÅ丮¸¦ Àоîµé¿©(scan) Á¤·ÄÇÒ¶§ »ç¿ëÇÕ´Ï´Ù. ; ´ÜÀ§´Â s(seconds), m(minutes), h(hours), d(days)·Î ¼³Á¤°¡´ÉÇϸç, ; ±âº»°ªÀº 1h(1½Ã°£)ÀÌ°í, 0À¸·Î ¼³Á¤Çϸé 'cache purning'À» disableÇÑ´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.cache_file_prune_period = 1h ; ÇϳªÀÇ Ä³½Ã ÆÄÀÏ¿¡ ´ëÇÑ ttl(time to live) ¼³Á¤. (±¤°íÀÇ ttlÀÌ ¾Æ´Ô^.^) ; Áï ³×ÀÓ¼­¹ö¿¡¼­ ¼³Á¤ÇÑ TTL°ú °°Àº °³³äÀÔ´Ï´Ù. ; ±âº»°ªÀº 1d(ÇÏ·ç)ÀÔ´Ï´Ù. ; ÇÏ·ç´ÜÀ§³ª ±âŸ Á¤±âÀûÀ¸·Î À¥¼­¹ö¸¦ restart ÇÒ °æ¿ì´Â ±× ±â°£º¸´Ù ´õ ; ±æ°Ô ¼³Á¤ÇÏ°í, ij½Ã ÆÄÀÏÀ» ÀÚÁÖ ¾÷µ¥ÀÌÆ®ÇÒ°íÀÚ ÇÑ´Ù¸é ttlÀ» ª°Ô Àâ¾Æ ; ÁÖµµ·Ï ÇÕ´Ï´Ù. ; ; <ÁÖÀÇ> ; ij½ÃÆÄÀÏÀº ¼³Á¤ÇÑ ttl ½Ã°£ ¾È¿¡ PHPÄڵ尡 ¹Ù²î¸é ´Ù½Ã °»½ÅµÇ¹Ç·Î ; °­Á¦·Î ij½ÃÆÄÀÏÀ» Áö¿ï ÇÊ¿ä´Â ¾ø½À´Ï´Ù. ; ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.cache_file_ttl = 1d ; PHPA°¡ »ç¿ëÇÏ´Â °øÀ¯ ¸Þ¸ð¸®(shm, shared memory) ij½Ã Å©±â¸¦ megabytes ; ´ÜÀ§·Î ¼³Á¤ÇÕ´Ï´Ù. ; ±âº»°ªÀº 8MBÀÌ°í ¹°¸®Àû ¸Þ¸ð¸® ¿©À¯°¡ µÈ´Ù¸é ´õ Å©°Ô Àâ¾ÆÁÝ´Ï´Ù. ; PHPA¿¡¼­ »ç¿ëÇÑ ¸Þ¸ð¸® Á¤º¸¸¦ ¾Ë°í ½Í´Ù¸é 'phpa_cache_admin -mv' ½ÇÇà. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_size = 8 ; °øÀ¯¸Þ¸ð¸® Å° ¼³Á¤. ; ±âº»°ªÀº 0xc0deb00 ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_key = 0xc0deb00 ; °øÀ¯¸Þ¸ð¸® Æ۹̼Ç(8Áø¼ö) ¼³Á¤. ; ±âº»°ªÀº 666(-rw-rw-rw). ; °øÀ¯¸Þ¸ð¸® À¯Àú(phpa.shm_user)¿¡°Ô¸¸ Á¢±ÙÀ» Çã¿ëÇÏ·Á¸é 600 Á¤µµ·Î ¼³Á¤. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_perms = 644 ; °øÀ¯¸Þ¸ð¸® ij½Ã À¯Àú ¼³Á¤. ; httpd.conf ÆÄÀÏ¿¡¼­ User Áö½ÃÀÚ¿¡ ¼³Á¤ÇÑ À¯Àú¸¦ ÀǹÌ. ; (nobody, www, apache ...) ; 1.3.2 ÀÌ»ó ¹öÀüºÎÅÍ´Â ÀÚµ¿À¸·Î ¼³Á¤µÇ´Ï ±»Áö ¼³Á¤ÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. ; ; <ÁÖÀÇ> ; ±×·¯³ª, ÀÌ ¼³Á¤À» ÇÏÁö ¾ÊÀ¸¸é, 'phpa_cache_admin -m' ½ÇÇà½Ã, ; No shm cache available with key 0x0c0deb00. Check ; ¿Í °°Àº ¸Þ½ÃÁö¸¦ ³»¹Ç·Î ÀÌ À¯Æ¿¸®Æ¼¸¦ »ç¿ëÇÏ°íÀÚ ÇÑ´Ù¸é ÇØ´ç À¯Àú¸¦ ; ¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù. ; ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_user = nobody ; °øÀ¯¸Þ¸ð¸® ij½Ã ±×·ì ¼³Á¤ ; httpd.conf ÆÄÀÏ¿¡¼­ Group Áö½ÃÀÚ¿¡ ¼³Á¤ÇÑ ±×·ìÀ» ÀǹÌ. ; (nobody, www, apache ...) ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_group = nobody ; À¥ ¼­¹ö°¡ Á¾·áµÉ ¶§ °øÀ¯¸Þ¸ð¸®¿Í ¼¼¸¶Æ÷¾î¸¦ ÀÚµ¿ÀûÀ¸·Î Ç®¾î ³õÀ» °ÍÀÎÁö ; ¼³Á¤ÇÏ´Â Ç׸ñÀÔ´Ï´Ù. ; ±âº»°ªÀº on ÀÔ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_release_at_exit = on ; °øÀ¯¸Þ¸ð¸® üũ(rebalancing) Áֱ⠽𣠼³Á¤. ; <ÁÖÀÇ> ; PHPA´Â PHP Äڵ尡 º¯°æµÇ¸é Ç×»ó ´Ù½Ã ij½ÃÇÕ´Ï´Ù. ; ; ±âº»°ªÀº 5m(5ºÐ)À̸ç, s(seconds), m(minutes), h(hours), d(days)·Î ; ¼³Á¤°¡´É ÇÕ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_stats_check_period = 5m ; °øÀ¯¸Þ¸ð¸® ttl(time to live) ¼³Á¤ ; ±âº»°ªÀº 12h(12½Ã°£)À̸ç, s(seconds), m(minutes), h(hours), d(days)·Î ; ¼³Á¤°¡´É ÇÕ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; phpa.shm_ttl = 12h ; °øÀ¯¸Þ¸ð¸® ij½Ã¿¡¼­ Á¦¿ÜÇÒ ÆÄÀÏ ¼³Á¤. ; ¼³Á¤ ¹æ¹ýÀº 'php.ignor_files'¿Í µ¿ÀÏÇÕ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; ;phpa.shm_ignore_files = "/index.php,/a/help.php" ; °øÀ¯¸Þ¸ð¸® ij½Ã¿¡¼­ Á¦¿ÜÇÒ µð·ºÅ丮 ¼³Á¤. ; ¼³Á¤ ¹æ¹ýÀº 'php.ignor_dirs'¿Í µ¿ÀÏÇÕ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 7 ; phpa.shm_ignore_dirs = "/tmp/,/temp/,/nocache/" ; ÃÖ´ë °øÀ¯¸Þ¸ð¸® ¼ö ¼³Á¤. ; Áï ¾ÆÆÄÄ¡ Maxclients º¸´Ù ´õ Å©°Ô ¼³Á¤ÇÏ¸é µË´Ï´Ù. ; ±âº»°ªÀº 512ÀÔ´Ï´Ù. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_max_processes = 512 ; ÇϳªÀÇ ÇÁ·Î¼¼½º°¡ lockÀ» ¾ò±â À§Çؼ­ ±â´Ù¸®´Â ½Ã°£À» ÃÊ´ÜÀ§·Î ; ¼³Á¤ÇÕ´Ï´Ù(warning¿¡ °üÇÑ ·Î±×). ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_lock_threshold0 = 10 ; ij½Ã lockÀ» Áß´Ü(break)Çϱâ À§Çؼ­ ±â´Ù¸®´Â ½Ã°£À» ÃÊ´ÜÀ§·Î ¼³Á¤. ; ; ¼³Á¤±ÇÇÑ »ó¼ö°ª 1 ; phpa.shm_lock_threshold1 = 10 ------------------------------------------------------------ ¸¸¾à 1.3.2 ÀÌÇÏÀÇ ¹öÀüÀ» »ç¿ëÇÒ °èȹÀ̶ó¸é(?) ¾Õ¼­ ¾ê±âÇßµíÀÌ 'activation keys'¸¦ ¼³Á¤ÇØÁà¾ß ÇÕ´Ï´Ù. ÀÌ Å°ÀÇ ´ë»óÀº httpd.conf ÆÄÀÏ¿¡¼­ ServerName Áö½ÃÀÚ·Î ¼³Á¤ÇÑ ¸ðµç È£½ºÆ®°¡ ±× ´ë»óÀÔ´Ï´Ù. ServerAlias Áö½ÃÀÚ·Î ¼³Á¤ÇÑ È£½ºÆ®´Â ±× ´ë»óÀÌ ¾Æ´Õ´Ï´Ù. 'activation keys'¸¦ ¼³Á¤ÇÏ´Â ¹æ¹ýÀº Çϳª ÇϳªÀÇ ServerName¿¡ ´ëÇؼ­ ¾ÆÆÄÄ¡ °¡»ó È£½ºÆ®ÀÇ °¢ ¼½¼Ç¿¡, php_value phpa.registration_key xxxxxxxxxxxxxx À¸·Î ¼³Á¤ÇÏ´Â ¹æ¹ý°ú 'phpa.keys' ÆÄÀÏÀ» »ý¼ºÇÏ¿© ¼³Á¤ÇÑ ¹æ¹ýÀÌ ÀÖ½À´Ï´Ù. ÈÄÀÚÀÇ ¹æ¹ýÀÌ ´õ È¿À²ÀûÀ̹ǷΠÀÌ ¹æ¹ýÀ» ±ÇÀåÇÕ´Ï´Ù. # cat /usr/local/apache/conf/httpd.conf | egrep "^[^#]*ServerName" ServerName localhost ServerName www.linux.ac.kr ServerName myhost.net ServerName myhost.com ServerName home.linux.ac.kr ServerName mail.linux.ac.kr # ServerAlias°¡ ¾Æ´Ñ ServerName Áö½ÃÀÚ·Î ¼³Á¤ÇÑ ¸ðµç È£½ºÆ®¿¡ ´ëÇؼ­ ´ÙÀ½ÀÇ ½ÎÀÌÆ®¸¦ ¹æ¹®ÇÏ¿© key ÆÄÀÏÀ» »ý¼ºÇÏ¿© ´Ù¿î·ÎµåÇÕ´Ï´Ù. [Download Activation Keys] Ç׸ñ - http://www.php-accelerator.co.uk/activate.php ¾ÕÀÇ È£½ºÆ®¸¦ ¿¹¸¦ µéÀÚ¸é, --------- phpa.keys ------------------------------ localhost f5eaa9f7856d20312d755d6c29bc5d42 www.linux.ac.kr 50bb1185c863f8e6dec18dda5c3766d2 myhost.net 61b36f78c681ca85ea9514ca174e2ed3 myhost.com 2d29a4df6fde7b0f3a5f4b877fa6b4fb home.linux.ac.kr 7f3e5ce1a68f1c20adff30b5f73f6366 mail.linux.ac.kr 2bb06f20b0966dca91f42b8b697e1db8 --------------------------------------------------- ÀÌ¿Í °°½À´Ï´Ù. ÀÌ ÆÄÀÏ¿¡¼­ '#'Àº ÁÖ¼®À̹ǷΠÇÊ¿ä¾ø´Â È£½ºÆ®¿¡ ´ëÇؼ­ »èÁ¦Çϰųª ÁÖ¼®(#)À» Ãß°¡ÇÏ¸é µË´Ï´Ù. »ý¼ºµÈ phpa.keys ÆÄÀÏÀ» /usr/local/apache/conf/phpa.keys ¶Ç´Â /usr/local/lib/php.keys À§Ä¡·Î ¿Å°Ü³õ°í php.ini ÆÄÀÏÀ» ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÕ´Ï´Ù. [¼öÁ¤ Àü] phpa.registration_keys_file = [¼öÁ¤ ÈÄ] phpa.registration_keys_file = /usr/local/apache/conf/phpa.keys ÀÌ»óÀ¸·Î php.ini ¼³Á¤Àº ¸ðµÎ ³¡³µ½À´Ï´Ù. ¼³¸íÀÌ Á» ±æ¾úÁö¸¸ ºñ±³Àû ¾î·Á¿î ÆíÀº Àý´ë ¾Æ´Õ´Ï´Ù. 3. ÀÛµ¿È®ÀÎ php.ini ¼³Á¤ÀÌ ¸ðµÎ ³¡³µÀ¸¸é ¾ÆÆÄÄ¡¸¦ Àç½ÃÀÛÇÕ´Ï´Ù. # apachectl restart (±âŸ ¿øÇÏ´Â ¹æ¹ý´ë·Î) ÀÛµ¿À» È®ÀÎÇÏ´Â ¹æ¹ýÀº ¿ì¼± phpinfo.php ÆÄÀÏÀ» Àû´çÇÑ DocumentRoot¿¡ »ý¼ºÇÏ°í ´ÙÀ½ÀÇ ³»¿ëÀ» Ãß°¡ÇÕ´Ï´Ù. ------ phpinfo.php -------------------------------- \n"; phpinfo(); ?> --------------------------------------------------- [À¥ºê¶ó¿ìÀú·Î È®ÀÎÇÒ °æ¿ì] array(3) { ["ENABLED"]=> bool(true) ["iVERSION"]=> int(10302) ["VERSION"]=> string(5) "1.3.2" } This program makes use of the Zend Scripting Language Engine: Zend Engine v1.2.0, Copyright (c) 1998-2002 Zend Technologies with the ionCube PHP Accelerator v1.3.2, Copyright (c) 2001-2002, by Nick Lindridge [telnetÀ¸·Î È®ÀÎÇÒ °æ¿ì] # telnet localhost 80 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. HEAD /phpinfo.php HTTP/1.0 <-- Á÷Á¢ ÀÔ·Â <-- ÀÔ·Â HTTP/1.1 200 OK Date: Thu, 01 Aug 2002 01:38:14 GMT Server: Apache/1.3.24 (Unix) mod_perl/1.27 PHP/4.2.1 mod_ssl/2.8.8 OpenSSL/0.9.6c X-Powered-By: PHP/4.2.1 X-Accelerated-By: PHPA/1.3.2 <-- È®ÀÎ »çÇ× Set-Cookie: PHP_SID=a6f5c749410253a3e3bc052095e1db92; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Connection: close Content-Type: text/html Connection closed by foreign host. [lynx·Î È®ÀÎÇÒ °æ¿ì] # lynx -head -source -useragent='Mozilla/4.0' http://localhost/phpinfo.php HTTP/1.1 200 OK Date: Thu, 01 Aug 2002 01:42:32 GMT Server: Apache/1.3.24 (Unix) mod_perl/1.27 PHP/4.2.1 mod_ssl/2.8.8 OpenSSL/0.9.6c X-Powered-By: PHP/4.2.1 X-Accelerated-By: PHPA/1.3.2 <-- È®ÀÎ »çÇ× Set-Cookie: PHP_SID=4dd63685ea4511eb8ecd786e59315caf; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Connection: close Content-Type: text/html [wgetÀ¸·Î È®ÀÎÇÒ °æ¿ì] # wget -S --spider --user-agent='Mozilla/4.0' http://localhost/phpinfo.php --01:46:26-- http://localhost:80/phpinfo.php => `phpinfo.php' Connecting to localhost:80... connected! HTTP request sent, awaiting response... 200 OK 2 Date: Thu, 01 Aug 2002 11:56:26 GMT 3 Server: Apache/1.3.24 (Unix) mod_perl/1.27 PHP/4.2.1 mod_ssl/2.8.8 OpenSSL/0.9.6c 4 X-Powered-By: PHP/4.2.1 5 X-Accelerated-By: PHPA/1.3.2 <-- È®ÀÎ »çÇ× 6 Set-Cookie: PHP_SID=55eef3a4dcfdc75eaa7d743867bfcf4b; path=/ 7 Expires: Thu, 19 Nov 1981 08:52:00 GMT 8 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 9 Pragma: no-cache 10 Connection: close 11 Content-Type: text/html 12 200 OK ÀÌ¿Í °°ÀÌ 'X-Accelerated-By: PHPA/1.3.2' Ç׸ñÀÌ ³ª¿À¸é Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÑ´Ù´Â ÀǹÌÀÔ´Ï´Ù. 4. °£´ÜÇÑ ¼Óµµ Å×½ºÆ® PHPA º¥Ä¡¸¶Å©¿¡ °üÇÑ ³»¿ëÀº ´ÙÀ½ÀÇ ½ÎÀÌÆ®¿¡¼­ º¼ ¼ö ÀÖ½À´Ï´Ù. - http://www.phpinsider.com/benchmarks/ - http://www.php-accelerator.co.uk/testimonials.php ±×·³ ½ÇÁ¦·Î Çѹø °£´ÜÇÏ°Ô ¼Óµµ Å×½ºÆ®¸¦ Çغ¾½Ã´Ù. ÁÖÀÇÇÒ Á¡Àº °´°üÀûÀÎ Àý´ëÀûÀÎ ¼öÄ¡°¡ ¾Æ´Ï¹Ç·Î ´ëÃæ ¾î´À Á¤µµ·Î¸¸ ÆÇ´ÜÇÏ½Ã±æ ¹Ù¶ø´Ï´Ù. ¿ì¼± php.ini ÆÄÀÏÀ» ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÏ°í ¾ÆÆÄÄ¡¸¦ Àç½ÃÀÛÇÕ´Ï´Ù. ------------ php.ini ----------------------------------- auto_prepend_file = /usr/local/apache/header.php auto_append_file = /usr/local/apache/footer.php phpa.ignore_files = "/nocache/test.php" phpa.ignore_dirs = "/tmp/,/temp/,/nocache/" phpa.shm_ignore_files = "/nocache/test.php" phpa.shm_ignore_dirs = "/tmp/,/temp/,/nocache/" --------------------------------------------------------- ------------ ¶Ç´Â DocumentRoot/nocache/.htaccess--------- php_value auto_prepend_file /usr/local/apache/header.php php_value auto_append_file /usr/local/apache/footer.php php_value phpa 0 --------------------------------------------------------- ------------ header.php --------------------------------- --------------------------------------------------------- ------------ footer.php --------------------------------- \n"; echo get_microtime($_start,microtime()); } ?> --------------------------------------------------------- ±×¸®°í Àû´çÇÑ(ºñ±³Àû ±ä ½Ã°£ÀÌ ¿ä±¸µÇ´Â) PHP Äڵ带 ÀÛ¼ºÇÏ¿©(¿¹: test.php) DocumentRoot/cache.php¿Í DocumentRoot/nocahe/test.php ÆÄÀÏ·Î °¢°¢ º¹»çÇÕ´Ï´Ù. À¥ºê¶ó¿ìÀú·Î ¿äûÇϸé Á¦ÀÏ ÇÏ´Ü¿¡ ½ÇÇà¼Óµµ°¡ Ç¥½ÃµÇ¹Ç·Î ¼­·Î ºñ±³ÇÏ½Ã¸é µË´Ï´Ù. ¾Æ·¡´Â ÇÊÀÚ°¡ Å×½ºÆ®ÇÑ ¼öÄ¡(Àý´ëÀûÀÎ ¼öÄ¡°¡ ¾Æ´Ô)ÀÔ´Ï´Ù. - glibc/2.2(·¹µåÇÞ 7.0±â¹Ý) - Apache/1.3.24 - PHP/4.2.1 - PHPA/1.3.2 - Zend optimizer/1.3.1 - (Zend Accelerator ´Â Á¦¿ÜÇÔ) - Å×½ºÆ® 1 : for($i=0; $i<1000000; $i++) ; - Å×½ºÆ® 2 : JSBoard 1.3.7/MySQL 3.23.51(localhost) - °á°ú ---------------------------------------------------------- ±¸ºÐ Å×½ºÆ® 1 Å×½ºÆ® 2 (list/read) ---------------------------------------------------------- none 3.64 0.33/0.33 Zend optmizer 1.47 0.33/0.33 PHPA 3.23 0.12/0.17 ---------------------------------------------------------- Å×½ºÆ® 1Àº ¿ÀÈ÷·Á PHPAº¸´Ù Zend optimizer°¡ ´õ ºü¸¥ °á°ú¸¦ ³À´Ï´Ù. Áï ´Ü¼øÇÑ ¼öÇÐÀûÀÎ(?)ÀÎ °è»ê¿¡¼­´Â Zend optimizer°¡ ´õ ºü¸£Áö¸¸ ´ëºÎºÐÀÇ È¨ÆäÀÌÁö°¡ ÀÌ¿Í °°ÀÌ ´Ü¼øÇÏ°Ô ±¸¼ºµÇ¾î ÀÖÁö ¾Ê´Ù´Â Á¡À» °£°úÇؼ­´Â ¾ÈµË´Ï´Ù. Å×½ºÆ® 2ÀÇ °á°ú¸¦ º¸¸é È®½ÇÇÏ°Ô ¾Ë ¼ö ÀÖ½À´Ï´Ù. °á·ÐÀûÀ¸·Î ¾ÆÁÖ ´Ü¼øÇÑ ¼öÇÐÀûÀÎ °è»êÀÌ ¸¹ÀÌ µé¾î°¡ ÀÖ°í ºñ±³Àû PHP Äڵ尡 ÀûÀº ȨÆäÀÌÁöÀÎ °æ¿ì¿¡´Â Zend optimizer°¡ ´õ À¯¸®ÇÏÁö¸¸ ±×·¸Áö ¾ÊÀº ÀϹÝÀûÀΠȨÆäÀÌÁö³ª ¼îÇθô Á¤µµÀÇ ¼öÁØ¿¡¼­´Â ¿ª½Ã PHPA°¡ ´õ À¯¸®ÇÕ´Ï´Ù. PHPA°¡ Zend Accelerator¿¡ ±ÙÁ¢ÇÑ ¼öÄ¡¸¦ ³½´Ù´Â Á¡À» °¨¾ÈÇßÀ» ¶§ ¿Ö Zend Accelerator°¡ »ó¿ëÀ¸·Î ¼­ºñ½ºµÇ°í ÀÖ´ÂÁö »ý°¢ÇØ º¸¸é ½±°Ô ±× ÇØ´äÀ» ãÀ» ¼ö ÀÖ½À´Ï´Ù. 5. °ü¸®ÀÚ¿ë À¯Æ¿¸®Æ¼ PHPACA /usr/local/bin/phpa_cache_admin À¯Æ¿¸®Æ¼¸¦ ÀÌ¿ëÇؼ­ ¸Þ¸ð¸® »ç¿ëÀ» º¼ ¼ö ÀÖ½À´Ï´Ù. <ÁÖÀÇ> phpa.shm_user = nobody phpa.shm_group = nobody ÀÌ ¼³Á¤À» ÇÏÁö ¾ÊÀ¸¸é, 'phpa_cache_admin -m' ½ÇÇà½Ã, 'No shm cache available with key 0x0c0deb00. Check' ¿Í °°Àº ¸Þ½ÃÁö¸¦ ³»¹Ç·Î °¡´ÉÇÑ ÀÌ¿Í °°ÀÌ ¼³Á¤Çϼ¼¿ä. ---------------------------------------------------- # phpa_ache_admin -vm shm size 8.0MB bytes mempool size 8.0MB mempool bytes allocated 64.0KB mempool max bytes allocated 64.0KB mempool bytes free 7.9MB mempool overhead 8.1KB cache enabled # # phpa_ache_admin -m 8388608:8372136:65536:65536:8298348:8252:0:0:m # # phpa_cache_admin --help Usage: -k | --shm-key Specify the shm cache key in either decimal or hex (with 0x prefix) Defaults to 0x0c0deb00 -m | --mem-info Dump memory usage info. Dumped fields are: shared memory segment size memory available for shm cache bytes allocated to cache entries maximum bytes ever allocated to cache entries free bytes available in cache cache overhead in bytes cache enable/disable status or disabled time cache reinitialise status or time -f | --file-info Dump cache entries. Dumped fields are: time to cache entry expiry time to live setting source filename filesize of phpa_* cache file source script file device number source script file inode number source script modification time (seconds since 0 hours UTC, Jan1, 1970) source script cache time (seconds since 0 hours UTC, Jan1, 1970) -p | --process-info Dump process stats and table entries. Dumped process stats are: count processes using cache maximum count of processes using cache count of active requests maximum count of active requests Dumped process entry fields are: process id request start time file device file inumber file path Entries are only given for processes with active requests, and one line is shown for each included/required file per process. It is possible that the same file may be listed more than once per process. -d | --disable-cache Disable the cache. Once disabled, new requests will not use the shm cache but still make use of the file cache. -e | --enable-cache Enable the shm cache. -r | --reinitialise-cache Reinitialise the shm cache. If there are no active server requests then the cache is reinitialised immediately. Otherwise the cache is disabled, set to reinitialise, and will be reinitialised when the last server request completes. After reinitialisation the cache is enabled. -D | --delete-cache Deletes the shm cache immediately. Using this while the web server is running will break phpa. Use it if the shared memory hasn't been deleted after a previous restart/shutdown and if phpa logs warnings about being unable to map the shared memory. A failsafe restart procedure should be to stop apache, kill any httpd processes that didn't exit, run 'phpa_cache_admin -D', restart web server. -v | --verbose This may be specified to give more verbose output to the -f, -m and -p options. -V | --version Display the PHPA version. -h | --help | -? This text. ---------------------------------------------------- ¶ÇÇÑ ´ÙÀ½ÀÇ ½ÎÀÌÆ®¸¦ ¹æ¹®ÇÏ¿© phpaca.tgz ÆÄÀÏÀ» ´Ù¿î·ÎµåÇÏ¿© Á÷Á¢ À¥¿¡¼­ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù. Zend Accelerator¿¡¼­ »ç¿ëÇÑ Åø°ú ºñ½ÁÇϳ׿ä. (±â´ÉÀº ¸¹ÀÌ ¶³¾îÁö±â´Â ÇÏÁö¸¸...) - http://www.edinger.info/phpaca.php Âü°í·Î 1.3.2 ¹öÀü¿¡´Â flush-phpa-cache À¯Æ¿¸®Æ¼¸¦ Á¦°øÇÏÁö ¾Ê±â ¶§¹®¿¡ ´Ù¿î·ÎµåÇÑ phpaca.tgz ÆÄÀÏÀ» ¾ÐÃà Ç®°í, config.inc.php ÆÄÀÏ¿¡¼­ DEFINE(CACHE_FLUSH,''); ¶Ç´Â DEFINE(CACHE_FLUSH,'/usr/local/bin/phpa_cache_admin'); À¸·Î ¼³Á¤Çϵµ·Ï Çϼ¼¿ä. Âü°í·Î MSIE¿¡¼­´Â º¸ÀÌÁö ¾ÊÀº ¹ö±×°¡ ÀÖ±º¿ä. 6. ±âŸ Á¤º¸ ³ªÁßÀ» À§Çؼ­....... 7. Èıâ ÀÌ ¹®¼­ ÀÛ¼ºÇÏ°Ú´Ù°í ¸¶À½¸ÔÀºÁö ¹ú½á ¹Ý³âÀÌ Áö³µ±º¿ä.....T.T À߸øµÈ Á¡À̳ª º¸°­ÇÒ ³»¿ëÀÌ ÀÖÀ¸¸é, http://www.linuxchannel.net/board/?table=qna ¿¡ ¿Ã·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù. EOF