±Ù¿ø¿¡¼­ Áý°èÇØ¼­ ¸®´ª½º¿¡ ÀÖ´Â XCache PHP ´ÜÃà۸¦ ¼³Ä¡ÇϽʽÿÀ

XCache´Â ´ë¾È ±×·¯³ª °í¸íÇÑ eAccelerator ¹× APC (¾çÀÚÅÃÀÏ PHP ½Ã··)¿Í À¯»çÇÑ ºü¸¥ ¾ÈÁ¤µÇ¾î ÀÖ´Â PHP ´ÜÃàŰ ¹× opcode cacherÀÌ´Ù. PHPÀÇ Áý°èÇÑ bytecode (opcode ¶Ç´Â Áß°£ ºÎÈ£) ¸ð¾çÀ» ¼û±â±â ´öºÐ¿¡ XCache ¿¬Àå ÀÏÀº °¢ ÆäÀÌÁö ¿äû¿¡ PHP ¿ø½Ã Äڵ带 ºÐ¼®Çϰí Áý°èÇϱâ À§ÇÏ¿© °£Á¢ºñ¸¦ ÇÇÇϱâ À§ÇÏ¿© ´ëº»À» ¾²°í, ÀÌ·¸°Ô ¼­¹ö ÁüÀ» °¨¼Ò½Ã۰í, PHP ¿øº»ÀÇ ¼º°ú¸¦ ¹Ð¾îÁÖ°í 2-10 ½Ã°£¿¡¼­ PHP ºÎÈ£ÀÇ ¼Óµµ¸¦ Áõ°¡½ÃŲ´Ù.

XCache´Â PHP 4.3 PHP 4.4, PHP 5.1 ¹× cPanel¿Í Plesk¿¡ ÀÌ¿ëµÈ °øÀ¯Áö°¡ À¥ È£½ºÆÃ ¼­¹öÀÇ ±âÃʸ¦ µÐ CentOS, ±×¸®°í ThreadSafe ¶Ç´Â â À¥ ¼­¹ö¸¦ Æ÷ÇÔÇÏ¿© ¸®´ª½º ¼­¹ö¿¡ PHP 5.2¿Í °°Àº ÃֽŠPHP cvs ºÐÁö ¸ðµÎ¸¦ Áö¿øÇÑ´Ù. XCache´Â »õ·Î¿î PHP ¹öÀüÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù¿Í °°Àº opcachers ¶Ç´Â ´ÜÃàŰ¿¡ Á¸ÀçÇÏ´Â ¸¹Àº ¹®Á¦¸¦ ±Øº¹ÇÑ´Ù. ÀÇ ¿·¿¡, ¶ÇÇÑ ÀÎ XCache ±âÁØÀ» Á¤ÇÏ´Â ´õ ºü¸£±â À§ÇÏ¿© ´Ù¸¥ opcode cachers º¸´Ù´Â.

À̰ÍÀº ¿ø½Ã ÄÚµå Æ÷Àå¿¡¼­ ¼öµ¿À¸·Î Áý°èÇØ¼­ XCache PHP cacher¸¦ ¼³Ä¡ÇÏ´Â ¹æ¹ý¿¡ °üÇÑ °£´ÜÇÑ ÀÚ½À¼­ ±×¸®°í °¡À̵å ÀÌ´Ù. ´ç½ÅÀÌ Wordpress¸¦ »ç¿ëÇϰųª Wordpress blog ¼º°ú¸¦ °¡¼ÓÈ­ÇÏ°í °³·®Çϱâ À§ÇÏ¿© XCache¸¦ ÀÌ¿ëÇÏ´Â °æ¿ì¿¡, ´ç½ÅÀº PHP 4°¡ ÄÚ¸àÆ® ºÎºÐ ÆäÀÌÁö ¼±Àû ¹× µîµîÀ» ¹èÄ¡Çұ⠼ö ¾ø½À´Ï´Ù¿Í °°Àº ºÒ¾ÈÁ¤¼º ¹®Á¦Á¡À» ÀÏÀ¸Å°´Â ¿øÀÎÀÌ µÇ±âÁöµµ ¸ð¸£±â ¶§¹®¿¡ ù°·Î PHP°¡ ÃֽйöÀü (PHP 5.2.1)¿¡ °Ý»óµÈ¤¤´Ù´Â °ÍÀ» º¸ÁõÇØ¾ß ÇÑ´Ù. ¾î·µç, PHP5´Â Ç×»ó ¸¸ÀÏ °¡´ÉÇÏ´Ù¸é ÃßõµÈ´Ù. ±×¸®°í ¸ðµç PHP ´ÜÃàŰ·Î °Í°ú °°ÀÌ, XCache´Â PHP suEXEC¸¦ ÄÒ´Ù »ç¿ëÇÏÁö ¾ÊÀ» °ÍÀÌ´Ù. PHP suEXEC´Â Á¦´ë·Î ÀÛµ¿Çϱâ À§ÇÏ¿© XCache¸¦ À§ÇØ ¹«´ÉÇØ¾ß ÇÑ´Ù.

ÇöÀç, XCache´Â 2°³ ºÐÁö¸¦, i.e À¯ÁöÇÑ´Ù. ¹öÀü 1.0.3¿Í ¹öÀü 1.2.0. ¹öÀüÀº µÑ ´Ù Áö±Ý PHP 4.3.x¿Í 4.4.x¸¦ À§ÇØ, ±×¸®°í PHP 5.0.x ½Ã¸®Á Á¦¿ÜÇϰí 5.1.x ±×¸®°í 5.2.x¸¦ Æ÷ÇÔÇÏ¿© PHPÀÇ ÃÖ´ë ¹öÀüÀ» À§ÇØ ÃßõµÈ, ¹öÀü 1.0.x°¡ ¾ÈÁ¤µÇ¾î ÀÖ´Â ¹æÃâ, ÃßõµÈ ¹öÀü 1.2.xÀÌ´Ù. ´ç½ÅÀÌ PHP4¸¦ »ç¿ëÇÏ´Â °æ¿ì¿¡, µÎ ´ç½ÅÀÇ ½ÅûÀ» À§ÇØ °¡Àå Àû´çÇÑ °ÍÀ» ¾¥½Ã´Â XCacheÀÇ ¹öÀüÀ» ½ÃµµÇϽʽÿÀ. ´ç½ÅÀÌ usinng ¼³Ä¡ÇÏ´ÂÁö PHPÀÇ ¾î´À ¹öÀüÀ̶ó°íÀ̰ųª, ¸í·É php¸¦ - v°¡ ¹ßÇàÇϰųª µÚ¿¡ ¿À´Â ³»¿ëÀ» °¡Áø PHP ÆÄÀÏÀ» °Ë»çÇϱâ À§ÇÏ¿©´Â, ±× ÈÄ¿¡ À¥ ºê¶ó¿ìÀú¿¡¼­ ÆÄÀÏÀ» ºÎ¸£½Ê½Ã¿À:

<? php
phpinfo ();
?>

  1. »ç¿ëÀÚ ¸í·É ´ÙÀ½ ¸¦ »ç¿ëÇÏ´Â /usr/local/src¿Í °°Àº ÇöÁö ¿ø½Ã µð·ºÅ丮¿¡ º¯È­:

    CD /usr/local/src

  2. ´ç½ÅÀÌ ÀÓ¸í¿¡ ¼±ÅÃÇÏ´Â XCacheÀÇ ¹öÀüÀÇ ±Ù¿ø Æ÷ÀåÀ» ¸¸È¸ÇÏ°í ´Ù¿î·ÎµåÇϽʽÿÀ.

    wget http://210.51.190.228/pub/XCache/Releases/xcache-1.0.3.tar.gz (XCache 1.0.3¸¦ À§ÇØ)

    ¶Ç´Â

    wget http://210.51.190.228/pub/XCache/Releases/xcache-1.2.0.tar.gz (XCache 1.2.0¸¦ À§ÇØ)

  3. Untar´Â, µÚ¿¡ ¿À´Â ¸í·ÉÀÇ ÇÑÀ» °¡Áø ±â·Ï º¸°ü¼Ò¸¦ ÁöÆÛ¸¦ ¿­°Å³ª, Ç®°Å³ª ÃßÃâÇÑ´Ù:

    Ÿ¸£ - zxf xcache-*.tar.gz
    gzip - dc xcache-*.tar.gz | Ÿ¸£ - x

  4. ±Ù¿ø ³»¿ëÀ» °¡Áø xcache ÀüÈ­¹øÈ£ºÎ·Î µé¾î°¡½Ê½Ã¿À:

    cd xcache

  5. Trigger PHP building environment:

    phpize

  6. Optional but recommended practice is to build XCache outside of source directory:

    mkdir ../xcache-build
    cd ../xcache-build

  7. Run the configure with the option that you want, the basic is as below which will enable the XCache by default:

    ../xcache/configure –enable-xcache

    You can list out all available options by using ../xcache/configure –help command, which will display the following:

    –enable-xcache Include XCACHE support.
    –enable-xcache-optimizer XCACHE: (N/A)
    –enable-xcache-coverager XCACHE: Enable code coverage dumper
    –enable-xcache-assembler XCACHE: (N/A)
    –enable-xcache-disassembler XCACHE: Enable opcode to php variable dumper
    –enable-xcache-encoder XCACHE: (N/A)
    –enable-xcache-decoder XCACHE: (N/A)
    –enable-xcache-test XCACHE: Enable self test - FOR DEVELOPERS ONLY!!

  8. Compile the source with following command:

    make

    Ensure that no error occurred.

  9. If you haven¡¯t already using root account, su to root user.
  10. Install XCache binary with the following command:

    make install

    Ensure that no error occurred, and note down the extension installation path of the xcache.so.

  11. Next, XCache need to be configured and enabled in PHP.INI file. Locate the correct location of php.ini configuration file by using phpinfo() function (see sample listed above to check version of PHP). In web hosting environment, normally it¡¯s located in /etc or /usr/local/lib. If the install of PHP parses the /etc/php.d/ folder, then simply create a file in that folder named ¡°xcache.ini¡± or copy over the sample xcache.ini came with source package.

    Change back to xcache source unpack directory, and run the following command with root user:

    cat xcache.ini >> /etc/php.ini
    $EDITOR /etc/php.ini

    Note: change to the path of php.ini accordingly

    This will append the default XCache configuration to the end of php.ini. Alternatively, you can copy and paste the following text into the php.ini file yourself too:


    [xcache-common]
    ;; install as zend extension (recommended)
    zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-xxx/xcache.so
    ;; install as zend extension with thread-safe
    ; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
    ;; install as PHP extension (extension_dir must be set to the full path to xcache.so)
    ; extension = xcache.so

    [xcache.admin]
    xcache.admin.user = ¡°admin¡±
    xcache.admin.pass = md5($your_password)

    [xcache]
    xcache.shm_scheme = ¡°mmap¡±
    xcache.size = 16M
    xcache.count = 1
    xcache.slots = 8K
    xcache.ttl = 0
    xcache.gc_interval = 0

    xcache.var_size = 0M
    xcache.var_count = 1
    xcache.var_slots = 8K
    xcache.var_ttl = 0
    xcache.var_maxttl = 0
    xcache.var_gc_interval = 300

    xcache.test = Off
    xcache.readonly_protection = Off
    xcache.mmap_path = ¡°/dev/zero¡±
    xcache.coredump_directory = ¡°¡±
    xcache.cacher = On
    xcache.stat = On
    xcache.optimizer = Off

    [xcache.coverager]
    xcache.coverager = Off
    xcache.coveragedump_directory = ¡°¡±

  12. You can configure XCache to your preference. One setting that must be changed is under the [xcache-common], where you must specify the correct installation path of the XCache extension module. You can also opt to run XCache as PHP extension instead of extension for Zend module. In this case, comment and uncomment the line accordingly. Other important options include ¡°xcache.size¡± which specify amount the memory allocated to XCache, ¡°xcache.count¡± to take advantage of multi-core processors or multiple processors. And if you plan to use XCache web administration interface, input the ¡°xcache.admin.user¡± and md5 checksum value of ¡°xcache.admin.pass¡±. Try MD5 tools to generate the correct value, or use the following command to generate the MD5 for your password:

    echo -n ¡°password¡± | md5sum

    Note: Explanation and definition of all XCache INI settings can be found here.

  13. Restart the Apache httpd web server. The following commands should work:

    /etc/init.d/apache* restart

    or

    /etc/init.d/httpd* restart

  14. Ensure the XCache is running by calling PHP file with phpinfo() (see sample above). You should see a new XCache Support block with opcode cache enabled.
  15. If you wish to set up XCache administration page, configure an alias in httpd.conf of Apache to point to the admin subdirectory within XCache. To do so, add the following line to httpd.conf (assuming your xcache source is extracted at /usr/local/src/, and you want to access admin page from /xcache-admin/ URL):

    Alias /xcache-admin/ /usr/local/src/xcache/admin/

    Then restart Apache web server. For lighttpd, add the following line instead:

    alias.url += (¡±/xcache-admin/¡± => ¡°/usr/share/xcache/admin/¡±)

    Alternatively, you can also copy the whole ¡°admin¡± directory from the ¡°xcache¡± source folder to web document-root or sub-directory of your domain which is web accessible. However, this method is not recommended as you may forget to update the admin page when XCache package is updated.

    Note: Ensure that open_basedir protection, if enabled, is excluded for the directory contains admin-page.

IMPORTANT: This is a machine translated page which is provided "as is" without warranty. Machine translation may be difficult to understand. Please refer to original English article whenever possible.

Share and contribute or get technical support and help at My Digital Life Forums.



Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

Thread Safety must be disbaled in php.ini - how to install php accelerator - suse php accelerator - "Thread Safety must be disabled in php.ini" - accelerator x for linux - linux php accelerator - php accelerator wordpress - install xCache - linux compiling php extensions - compiling anastasia source code - compile form of PHP - compile my sources linux - php extention .so location inlinux - php accelerator ubuntu - akcelerator apache - XCache installation - APC php plesk - disabilitare Thread Safety in php.ini - linux apache accelerator - php gzip plesk - php Zend Core 2.5 no command line - plesk php accelerator - XCache XCache-Optimizer Configure Command PHP - check apc centos - enable gzip in php.ini file - php العربي - +"Threadsafe PHP" +SuSe - centos worker php thread safe - centos upgrade php source "thread-safe" - compiling php 5.2 suse plesk - install apc on plesk - php accelerator tutorial - php apc 5.0.x - PHP fastest source code - XCache "php.ini" - apc accelerator phpsuexec - how to enable suexec+plesk+centos - install accelerator apche php - phpsuexec opcode - php accelerator linux - check content tar.gz inlinux - enable thread safety php centos - php+recompile+on+plesk+linux+centos - php accelator - plesk php extensions - XCache wordpress multiple - php Thread Safety linux' - linux accelerators - php compile thread safe - How to install APC PHP Accelerator Wordpress -