PHP.ph

10 Aug, 2008

Centos 5: Installing XCache From Source

Posted by: php In: Apache| Centos| Fedora Core| PHP

XCache is an open-source opcode cacher. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM.

Fedora 9, Centos 5: Xcache Install from Source

Through SSH.
yum install php-devel
yum install php-devel

yum groupinstall 'Development Tools'

yum groupinstall 'Development Libraries'

cd /src

Download the file.
wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz

tar xvfz xcache-1.2.2.tar.gz
Download xcache-1.2.2.tar.gz

cd xcache-1.2.2

phpize
phpize

./configure --enable-xcache

make
make, make install

make install

Copy .ini file
cp xcache.ini /etc/php.d

Edit/Vi xcache.ini
vi /etc/php.d/xcache.ini
vi xcache.ini

Sample config

[xcache-common]
zend_extension = /usr/lib/php/modules/xcache.so

[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = “admin”
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = “9a7821516bdd5d9a1586f094d6e1aacb”

[xcache]
xcache.shm_scheme = “mmap”
xcache.size = 32M
xcache.count = 2
xcache.slots = 1K
xcache.ttl = 3600
xcache.gc_interval = 300

xcache.var_size = 4M
xcache.var_count = 1
xcache.var_slots = 1K
xcache.var_ttl = 3600
xcache.var_maxttl = 3600
xcache.var_gc_interval = 300

; N/A for /dev/zero
xcache.readonly_protection = Off
xcache.mmap_path = “/dev/zero”
xcache.cacher = On
xcache.stat = On

Control Panel

Copy Xcache admin panel to your html directory.
cp -a ~/src/xcache-1.2.2/admin /var/www/html
or
cp -a admin /var/www/html/admin

Generating your Password

Setting up “quad” as your password.

echo -n “quad” | md5sum

It will return:
9a7821516bdd5d9a1586f094d6e1aacb

Copy.

or

echo "<?php echo md5("quad"); ?>" > /var/www/html/phppass.php

Point your browser to your phppass.php
http://server.domain.com/phppass.php

Copy the value displayed.
9a7821516bdd5d9a1586f094d6e1aacb

Edit xcache.ini
vi /etc/php.d/xcache.ini

Paste the value generated
xcache.admin.user = “admin”
xcache.admin.pass = “9a7821516bdd5d9a1586f094d6e1aacb”

Save xcache.ini file
ZZ

Restart apache
/etc/init.d/httpd restart

Create your phpinfo.php
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

Point your browser to your phpinfo.php to verify if xcache was installed successfully
http://server.domain.com/phpinfo.php
phpinfo.php

Point your browser to your xcache admin directory
http://server.domain.com/admin/
Admin Control Panel

Enter your username and password (in this example, password is “quad”.)

Tags: , ,

Comment Form

About PHP.ph

Linux Apache MySQL PHP