Installing xcache for PHP5 on Debian Etch

XCache is an opcode cacher for PHP developed by the Lighttpd team. The full description directly from http://xcache.lighttpd.net/

XCache is an opcode cacher for PHP developed by the Lighttpd team. The full description directly from http://xcache.lighttpd.net/

XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest PHP cvs branches such as PHP_4_3 PHP_4_4 PHP_5_0 PHP_5_1 PHP_5_2 HEAD(6.x). ThreadSafe/Windows is also supported. It overcomes a lot of problems that has been with other competing opcachers such as being able to be used with new PHP versions. See Introduction for more information.

There is no XCache package within the apt repositories for Debian Etch, however it is available within Debian SID/Testing. You will need to then download the source, compile it and install it. You can download the 1.2 stable source from the following here:

http://xcache.lighttpd.net/wiki/Release-1.2.2
http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz

The second link is the full XCache source, you can use “wget”, “curl” or lynx to retrieve the archive onto your machine.

Once downloaded, extract the archive and a directory called xcache-1.2.2 should have been created and you will want to change directory into it:


[root@jager:/root/source/xcache]# tar -zxvf xcache-1.2.2.tar.gz
[root@jager:/root/source/xcache]# ls -al
total 280K
drwxr-xr-x 3 root root 4096 2008-01-14 18:58 ./
drwxr-xr-x 4 root root 4096 2008-01-14 18:58 ../
drwxr-xr-x 5 513 513 4096 2007-12-28 10:00 xcache-1.2.2/
-rw-r--r-- 1 root root 269238 2007-12-28 23:45 xcache-1.2.2.tar.gz
[root@jager:/root/source/xcache]# cd xcache-1.2.2

You will need to make sure that you have “php5-devel” installed so you can use “phpize” to create the module, a simply “apt-get install php5-dev” as root should do the trick. You may need to type “rehash” if using tcsh to be able to run “phpize”.

Now we need to prepare the module for configuration by typing the following:


[root@jager:/root/source/xcache/xcache-1.2.2]# phpize --clean && phpize
Cleaning..
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

Then you will need to configure XCache before compiling, at this point you may want to run “./configure –help”. Which will provide information on the configuration options available for XCache that you can change when it compiles. If you don’t need to change anything, just run “./configure”.

If any errors were returned then you’re most likely missing some supporting packages and you will need to install them. If no errors were returned then you can simply run “make”.

Once the module has been compiled it should now reside within the “modules” directory. You can now copy to the proper PHP5 module directory:


[root@jager:/root/source/xcache/xcache-1.2.2]# cp modules/xcache.so /usr/lib/php5/20060613+lfs
`modules/xcache.so' -> `/usr/lib/php5/20060613+lfs/xcache.so'

Now that the module exists, we need to make a configuration file for it so that PHP5 will load the module and configuration. You should see a “xcache.ini” within the root folder of the extract archive. Just copy it to the correct configuration folder within /etc:


/etc/php5/apache/conf.d <- Configuration file for PHP5 as a Module in apache1.3x /etc/php5/apache2/conf.d <- Configuration file for PHP5 as a Module in apache2.x /etc/php5/cgi/conf.d <- Configuration file for PHP5 compiled as a CGI Binary /etc/php5/cli/conf.d <- Configuration file for PHP5 compiled as a Command Line Binary

For our example, I'm using the PHP5 CGI Binary:


[root@jager:/root/source/xcache/xcache-1.2.2]# cp xcache.ini /etc/php5/cgi/conf.d/.
`xcache.ini' -> `/etc/php5/cgi/conf.d/./xcache.ini'

Now make sure to edit the following configuration values within the xcache.ini file:


[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

Change the "zend_extension" to just "xcache.so" and comment out "zend_extension_ts " like so:


[xcache-common] ;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
extension = 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

You will also need to change the following from:


; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size = 64M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count = 1

To something like the following:


; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size = 64M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count = 4

If you have a Dual Pentium4 with Hyper Threading.

Just restart apache by issuing "invoke-rc.d apache2 restart", and all should be working!

To test whether or not the extension/module was loaded and working, you can put the following code within an PHP file and pull it up in your browser and search for XCache:



And you should see the following:


This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
with XCache v1.2.2, Copyright (c) 2005-2007, by mOo

Enjoy!


Did you like this article?


0 Shares:
You May Also Like

Seagate unveils turmoil-proof EE25.2 hard drive

Seagate unveils turmoil-proof EE25.2 hard drive - As if stuffing a quarter terabyte onto a single Barracuda platter and finally matching Hitachi in the 1TB realm weren't enough to gloat about, Seagate is now unveiling a hard drive aimed squarely at those reading this from the Amazon Rainforest (or a vanilla construction area, but you understand). The second-generation SATA EE25 drive -- easily dubbed the EE25.2 -- is available in sizes up to 80GB and can handle extreme temperatures, sensational heights, 'round the clock operation, 90-percent humidity, and drops / shocks that would likely put you out of commission before your data. No word yet on pricing nor availability, but don't expect 80 gigabytes of nearly indestructible storage to come without a premium.

 

Read | Permalink | Email this | Comments


Office Depot Featured Gadget: Xbox 360 Platinum System Packs the power to bring games to life!

[EnGadget]
Read More

Must have Thunderbird/Seamonkey Addons

If you don't know about Thunderbird, then you've been living under a rock. Its a small, lightweight, Email application provided free by the Mozilla foundation. I was looking around for Thunderbird add-ons this evening and found a couple that I found to be a "Must Have" for anyone that uses Thunderbird as their primary email client. I'll list them off in no particular order: Enigmail - OpenPGP message encryption and authentication for Thunderbird and Seamonkey.
Read More

Mobile Chat When Will it Work?

If you've had an iPhone since the launch of Apples Application Store, then you most likely have bought the app Mobile Chat. I mean who wouldn't, just looking at their features http://mobilech.at/features you'd be silly not to pick the only instant messenger on the iPhone. Granted there are Web App versions, but nothing application wise. Here are some of the features.
MobileChat supports the following protocols: * AIM/ICQ/.Mac/MobileME * Windows Live/MSN * Yahoo Messenger * GTalk * Jabber/XMPP Multiple Accounts
Read More

Microsoft Office Roundtable reviewed

Microsoft Office Roundtable reviewed -

Filed under:

The good people over at TMCnet want to keep you covered with their lengthy review of Redmond's five-camera foray into the teleconferencing game, which, as part of Microsoft's Unified Communications Platform, will probably be seeing a lot of action this year. And what are their feelings? Well, they get stoked on its resemblance to the ships in the 1953 version of War of the Worlds, dig the "head-size spatial equalization" (which makes everyone's head the same size, seriously), and think that maybe $3000 is a fair price. The only thing they weren't quite as excited about was the inability to use the panoramic features with non-Ballmerware, but even that appears to be a minor complaint. Still not sure you need one for your startup? Maybe you'd better read the whole thing.

 

Read | Permalink | Email this | Comments


Office Depot Featured Gadget: Xbox 360 Platinum System Packs the power to bring games to life!

[EnGadget]
Read More

Plans for Ubuntu 7.10 (Gutsy Gibbon) revealed

Another Ubuntu Release in the works!
To give you the rundown on the notable changes. The desktop version will be shipping with a new default windows manager that looks kinda like Mac OSX:


We are aiming for Ubuntu to be one of the first distributions to ship
the newly merged Compiz and Beryl projects (compcomm/OpenCompositing);
and enable it as the default window manager on systems with a supported
combination of hardware and drivers.



http://compiz.org


cube effect peel effect cube effect cube effect


And the addition of AppArmour to the Server version of Ubuntu:




For increased security, the AppArmor security framework will be
available as an option for those that want it.

The following is the original statement by the Ubuntu Development Manager.


Now that the set of feature goals planned for Ubuntu 7.10 ("Gutsy
Gibbon") has been largely finalised, it seems like an appropriate point
to announce the plan to the world.
While this is based on the approved blueprints for gutsy[0], which are
expected to be implemented in time, we do release according to a
time-based schedule[1] rather than a feature-based one. It is not
unusual for some planned features to be delayed to later releases;
happily it is also not unusual for our developers to introduce neat
features we weren't expecting either.
[0] https://blueprints.launchpad.net/ubuntu/gutsy/
[1] https://wiki.ubuntu.com/GutsyReleaseSchedule
Desktop
-------
Ubuntu 7.10 will ship with the latest edition of the GNOME desktop,
2.20, released a few weeks before our own release. Kubuntu 7.10 will
ship with KDE 3.5.7, and should also include packages of KDE 4.0 rc 2
available for optional side-by-side installation.
We are aiming for Ubuntu to be one of the first distributions to ship
the newly merged Compiz and Beryl projects (compcomm/OpenCompositing);
and enable it as the default window manager on systems with a supported
combination of hardware and drivers.
Systems which do not support compositing, or those with it disabled by
user option, will use the existing metacity window manager.
Hardware Support
----------------
Ubuntu 7.10 will use the 2.6.22 Linux kernel, along with our usual
selection of updated and additional drivers.
We will also use Xorg 7.3, giving better graphics hardware support and
the option of hotplugging monitors (RandR 1.2) and input devices
(xserver 1.4).
As well as the easier configuration for hotplugging-supported drivers
("no xorg.conf"), we also aim to have better configuration for other
drivers and fallback settings for when there is a problem.
Some "winmodem" chips will be supported out of the box, where drivers
are available; though this may rely on the use of restricted drivers.
Improvements to the Restricted Driver Manager are expected, allowing
drivers to be disabled by default and proposed by the manager. As
previously announced, an edition of Ubuntu without restricted enabled by
default is in the works.
Mobile
------
As announced, Ubuntu 7.10 will be first release to include a new Mobile
and Embedded edition targeted at hand-held devices and other
mobile/embedded form factors.
This integrates the Hildon UI components developed by Nokia into Ubuntu,
on top of the existing Ubuntu platform.
Server
------
Development of the Ubuntu 7.10 Server Edition has received a new boost
with a dedicated development team at Canonical working on it. Features
aiming to improve the experience for new and hobbyist administrators are
expected, as well as features desirable for small businesses and
organisations.
For increased security, the AppArmor security framework will be
available as an option for those that want it.
Stability and Performance
-------------------------
Ubuntu 7.10 should function significantly better when the filesystem is
full or otherwise not writable, allowing the user to make room and then
continue working without undue interruption.
Improvements to our "apport" bug and crash reporting infrastructure are
planned, in particular integration with our software installation and
upgrade tools so that problems installing or upgrading packages can be
easily reported with relevant information attached. Kernel crashes will
also be intercepted on reboot, and may be reported using the tool.
Our efforts to improve boot reliability and performance continue;
unlimited and reliable stackability of software raid (MD) devices, LVM
volumes and software-managed (devmapper) devices will be supported with
no runtime ordering issues.
Ubuntu 7.10 will ship with Upstart 0.5, which will provide flexible and
reliable service supervision. We expect to harness this for suitable
core services, and some boot process tasks, as appropriate.
Scott
--
Scott James Remnant
Ubuntu Development Manager
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel-announce/attachments/20070619/d46e34e1/attachment.pgp


Read More