How to Build a Web Server with PHP 5 and MySQL 5 Support

Configuring and Installing Xcache

There are several PHP cache modules around – they help saving CPU resources from your server –, some also bringing PHP optimization, which improves PHP performance: PHP-Accelerator, Mmcache, APC and Xcache. We will show you how to configure and install Xcache, as it brings native support for PHP 5, so you won’t face any compatibility issue.

Look at https://210.51.190.228/pub/XCache/Releases/ for the latest Xcache release on the 1.2 series (1.2.0 at the time of this writing) on the tar.gz format.

The downloading, configuration and compilation sequence is the following:

cd /root
wget https://210.51.190.228/pub/XCache/Releases/xcache-1.2.0.tar.gz
tar –xvzf xcache-1.2.0.tar.gz
cd xcache-1.2.0
/usr/local/apache2/php/bin/phpize
./configure –enable-xcache –enable-xcache-optimizer –with-php-config=/usr/local/apache2/php/bin/php-config
make
make install

Please pay attention at the output to see where Xcache module was installed. In our case, it was installed under /usr/local/apache2/php/lib/php/extensions/no-debug-non-zts-20060613/.

Now edit php.ini (vi /usr/local/bin/apache2/php/php.ini) and add the following lines. Change the first one according to where xcache module was installed.

[xcache-common]
zend_extension = /usr/local/apache2/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so

; required for >=php5.1 if you turn XCache on
auto_globals_jit = Off

[xcache.admin]
xcache.admin.user = “admin”
; paste the output of md5(”password”) below
xcache.admin.pass = “”

[xcache]
xcache.size = 32M
xcache.count = 1
xcache.slots = 8K
xcache.mmap_path = “/dev/zero”
xcache.cacher = On
xcache.optimizer = On

You can install a web admin interface that comes with Xcache. To do that, you need to fill the xcache.admin.pass with a password in MD5 format (click here to convert a text password into MD5) and then copy admin folder from the Xcache installation directory to a directory on your web server, for example:

cd /root/xcache-1.2.0
mv admin /www/your-website/xcache

With this Xcache admin panel will be accessible through https://www.your-website.com/xcache

Restart Apache with /usr/local/apache2/bin/apachectl restart and check again your phpinfo output, this time looking for a Xcache session (“Xcache session: Enabled”). If it is there, you will have your webserver up and running with PHP 5, MySQL 5 support and PHP cache and optimization module. If not, repeat again the procedures described on this page.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *