phpwordpressnginxzend-frameworkxcache

How to check if xcache is installed properly?


I've installed xcache on a LEMP setting using the following commands:

cd /usr/local/src && wget https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz && tar -xzf xcache-3.2.0.tar.gz && cd xcache-3.2.0

phpize && ./configure --with-php-config=/usr/bin/php-config --enable-xcache --enable-xcache-optimizer --enable-xcache-coverager && make && make install

It worked and finally showed:

Installing shared extensions: /usr/lib/php5/20121212/

Then I added the following to php.ini

[xcache]
extension = " /usr/lib/php5/20121212/xcache.so"
xcache.admin.user = ""
xcache.admin.pass       = ""
xcache.admin.enable_auth = Off
xcache.test = Off
xcache.coredump_directory = ""
xcache.shm_scheme = mmap
xcache.cacher = On
xcache.size = 1024M
xcache.count = 8
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.mmap_path = "/dev/zero"
xcache.optimizer = Off
xcache.coverager = Off
xcache.coveragedump_directory = ""
xcache.stat     = Off
xcache.readonly_protection = Off

But when I check php -v all I can't see xcache. All I can see is:

PHP 5.5.9-1ubuntu4.19 (cli) (built: Jul 28 2016 19:31:33)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

What am I doing wrong? Please guide.


Solution

  • Just not to keep question without answer posting our discussion here:

    To install xcache use version distributed with your linux

    For Debian/Ubuntu

    > sudo apt-get install php5-xcache

    Why would you use outdated version of some (php extension) package?

    1. Maintained by community
    2. Tested
    3. 100% compatible with your version of PHP
    4. Configured - No need to edit your config

    If you 100% need to get a package that is not in repo use try to use pecl.

    >sudo pecl install package

    Pecl does make package for you almost same way as if you would build it yourself. But it allows you easier management and updates.

    So and the very last choice would be make it yourself. (Only do it if there is 100% need for a package). Worst option as you lose any level of management and need to maintain and upgrade package 100% yourself.

    3rd party PPAs - For security reasons I would never install package form any external 3rd party PPA to a production server.

    And one more thing pecl/self make would require you to install build tools on your machine. It uses lots of space and potentially might increase security risks for production server. So as an option create a VM copy of production server do a build/pecl on it, then just copy compiled library to your production server.