Xcache is a fast and stable PHP code-level cache that provides an effective buffer layer for servers under high load environments. Buffers similar to eaccelerator and APC are available.
This article describes how to install xcache pai_^ for PHP.
Test Environment setup
I used apache2 + PhP5 in centos5.5 to build a simple test environment. The website root directory is under/var/www/html.
View Current PhP5 Configuration
Before installing xcache, check your PHP configuration, create info. php in the/var/www/html directory, and write the following code:
?
1 |
touch /var/www/html/info
.php |
?
View the phpinfo information in the browser, http: // localhost/info. php
Of course, you still cannot see the xcache installation information.
If you see other caches in the configuration, such as eaccelerator or APC, You need to delete them first:
?
123456 |
# Deleting an eaccelerator
yum remove php-eaccelerator
# Delete APC yum remove php-pecl-apc
Restart the httpd server /etc/init .d /httpd
restart |
Start xcache Installation
Because xcache does not have an existing RPM installation package, we need to manually compile this module.
?
123456789101112131415 |
yum install
php-devel yum groupinstall
'Development Tools' yum groupinstall
'Development Libraries' # Download the latest xcache and decompress it
cd /tmp
wget http: //xcache .lighttpd.net /pub/Releases/1 .3.0 /xcache-1 .3.0. tar .gz
tar xvfz xcache-1.3.0.
tar .gz
cd xcache-1.3.0
# Use phpize tool to compile xcache
phpize . /configure
-- enable -xcache
make make install
# Copy the xcache configuration file to the PHP configuration directory.
cp xcache.ini
/etc/php .d |
Configure xcache
?
1234567891011121314 |
vi /etc/php
.d /xcache .ini
[xcache-common] ;; install
as zend extension (recommended), normally "$extension_dir/xcache.so" ;zend_extension =
/usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache .so
; zend_extension_ts =
/usr/local/lib/php/extensions/non-debug-zts-xxx/xcache .so
;; For windows
users , replace xcache.so with php_xcache.dll
;zend_extension_ts = c: /php/extensions/php_xcache .dll
;; or install
as extension, make
sure your extension_dir setting is correct extension = xcache.so
;; or win32: ; extension = php_xcache.dll
[...] xcache.size = 60M
[...] |
Restart Apache server
?
1 |
/etc/init .d /httpd
restart |
View the phpinfo information again. If you see the following two images, congratulations! The configuration is successful.