How to integrate XCache into PHP5 on a Fedora 8 or CentOS 5.1 system (with Apache2)

From the XCache project page: “XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load.” It’s similar to other PHP opcode cachers, such as eAccelerator and APC.

Tested this on a Fedora 8 server with the IP address 192.168.1.12 where Apache2 and PHP5 are already installed and working.  Apache’s default document root /var/www/html in this article is for demonstration purposes.  Of course, you can use any other vhost as well, but you might have to adjust the path to the phpinfo.php file.

2 Checking PHP5’s Current State

First, before we install XCache, let’s find out about our PHP5 installation. To do this, we create the file phpinfo.php in document root /var/www/html

vi /var/www/html/phpinfo.php

phpinfo();
?>

Afterwards, we call that file in a browser: http://192.168.1.12/phpinfo.php

Installing XCache

yum install php-devel

yum groupinstall ‘Development Tools’

yum groupinstall ‘Development Libraries’

Next we download and uncompress the latest XCache version:

cd /tmp
wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
tar xvfz xcache-1.2.2.tar.gz

Then we go to the new XCache source directory…

cd xcache-1.2.2

… and build XCache as follows:

phpize
./configure –enable-xcache
make
make install

Next we copy xcache.ini to the /etc/php.d directory:

cp xcache.ini /etc/php.d

Now we must configure XCache. The configuration options are explained here:  http://xcache.lighttpd.net/wiki/XcacheIni

The least you should do is enable extension = xcache.so and disable all zend_extension lines; furthermore, set xcache.size to a size (in MB) > 0 to enable XCache:

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  =                32M
[...]

That’s it. Restart Apache, and you’re done:

/etc/init.d/httpd restart

Afterwards, open phpinfo.php again in a browser: http://192.1681.1.12/phpinfo.php, You should now see XCache mentioned on the page

  • 11 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

OpenVZ basic commands

Following are some important commands which are normally used while working on a Hardware...

Howto List existing VPS

SSH to the master server and run the following command:/usr/sbin/vzlist -aThe -a switch tells the...

Install shoutcast server on CentOS server

Shoutcast is a free-of-charge audio homesteading solution. It permits anyone on the internet to...

Setup VNC server on VPS

We will discuss  setting up your VPS as a VNC server and using a client from your Windows...

PureFTPd Installation and Setup

IntroductionThe following HOWTO is aimed at installing and setting up a FTP server, based on...