I. Installation of XCache
Copy Code code as follows:
# wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
# tar ZXVF xcache-1.3.0.tar.gz
# CD xcache-1.3.0
#/usr/local/php/bin/phpize
#./configure--enable-xcache--enable-xcache-coverager--enable-xcache-optimizer--with-php-config=/usr/local/php/ Bin/php-config
# Make && make install
Note:
--enable-xcache says enable XCache support;
The--enable-xcache-coverager representation contains additional characteristics for measuring the efficacy of accelerators;
--enable-xcache-optimizer indicates enable opcode optimization
After installation, the system prompts the Xcache.so module to generate the path, this generation path is/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/, then moves xcache.so to/ The Usr/local/php/include/php/ext directory.
Second, configuration management XCache
1, modify the PHP configuration file
When configuring, we can refer to the XCache configuration template Xcache.ini, which is located in the XCache Setup program
# Vi/usr/local/php/lib/php.ini
Then add the following content
Copy Code code as follows:
Extension_dir=/usr/local/php/include/php/ext
[Xcache-common]
Extension = xcache.so
[Xcache.admin]
Xcache.admin.enable_auth = On
Xcache.admin.user = "XCache"
Xcache.admin.pass = ""
[XCache]
Xcache.shm_scheme = "Mmap"
xcache.size=60m
Xcache.count =1
Xcache.slots =8k
Xcache.ttl=0
Xcache.gc_interval =0
xcache.var_size=4m
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 = On
Xcache.mmap_path = "/tmp/xcache"
Xcache.coredump_directory = ""
Xcache.cacher =on
Xcache.stat=on
Xcache.optimizer =off
[Xcache.coverager]
Xcache.coverager =on
Xcache.coveragedump_directory = ""
2. Generate XCache Cache files
# Touch/tmp/xcache
# chmod 777/tmp/xcache
3, generate the secret of XCache administrator (MD5 ciphertext)
# echo-n "123456" | Md5sum
e10adc3949ba59abbe56e057f20f883e
Then paste the generated MD5 ciphertext into the php.ini file Xcache.admin.pass = "" option, xcache.admin.pass= "e10adc3949ba59abbe56e057f20f883e"
4, copy XCache management program to the site root directory
Copy Code code as follows:
# cp-a/tmp/xcache-1.3.0/admin//usr/local/nginx/html/
Then restart PHP, and then access Http://localhost/admin, the username is xcache password 123456, in addition, you can also use Phpinfo to verify whether PHP support XCache