Showing posts with label XCache. Show all posts
Showing posts with label XCache. Show all posts

Thursday, September 6, 2012

How to Compile and Configure XCache 2.x on CentOS 6 for PHP Optimization

While Memcached is widely recommended for web caching, opcode caches like XCache often deliver significantly better speed improvements and lower load averages for PHP-driven CMS platforms like Joomla on high-traffic servers.

Environment: CentOS 6.x • PHP 5.x • XCache 2.0.1

1. Compile XCache from Source

Install the PHP development headers and compile the XCache module with the optimizer enabled:

yum install php-devel -y
cd /usr/src
wget http://xcache.lighttpd.net/pub/Releases/2.0.1/xcache-2.0.1.tar.gz
tar -zxf xcache-2.0.1.tar.gz
cd xcache-2.0.1
phpize --clean && phpize
./configure --enable-xcache --enable-xcache-optimizer
chown -R nobody /usr/src/xcache-2.0.1
sudo -u nobody make
make install

2. Configure /etc/php.d/xcache.ini

Create the XCache configuration file. Adjust the zend_extension path depending on whether your architecture is 64-bit (/usr/lib64/php/modules/xcache.so) or 32-bit (/usr/lib/php/modules/xcache.so):

cat << 'EOF' > /etc/php.d/xcache.ini
[xcache-common]
zend_extension=/usr/lib64/php/modules/xcache.so

[xcache.admin]
xcache.admin.enable_auth = Off

[xcache]
xcache.shm_scheme        = "mmap"
xcache.size              = 64M
xcache.count             = 1
xcache.slots             = 8K
xcache.ttl               = 0
xcache.gc_interval       = 0
xcache.var_size          = 32M
xcache.var_count         = 1
xcache.var_slots         = 8K
xcache.var_ttl           = 0
xcache.var_maxttl        = 0
xcache.var_gc_interval   = 300
xcache.readonly_protection = Off
xcache.mmap_path         = "/dev/zero"
xcache.coredump_directory = ""
xcache.experimental      = Off
xcache.cacher            = On
xcache.stat              = On
xcache.optimizer         = On

[xcache.coverager]
xcache.coverager         = Off
xcache.coveragedump_directory = ""
EOF

3. Enable the Web Administration Panel

Copy the administrative GUI into your web root to monitor memory usage and cache hit rates:

cp -R admin /var/www/html/xcache-admin
service httpd restart

You can access the admin dashboard at http://your-server-ip/xcache-admin/index.php to monitor real-time hit ratios.

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...