Building from source
Strong suggestion is to use prebuild packages, if there is suitable ones available for your system. Prebuild packages contain sane defaults, init-scripts and are generally workable out of the box.
However, if you decide to build from source :
- You need to have working compiler and some knownledge of configure-style build process.
- You need something like php5-dev package on you system. (php4-dev should also work, but untested.)
Building and installing
Unpack the archive :
munlap:~/BUILD$ tar -xjf scache-0.99.0.tar.bz2 munlap:~/BUILD$ cd scache-0.99.0
munlap:~/BUILD/scache-0.99.0$ ./configure --prefix=/usr/local/scached checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk ....(snip).... checking netinet/ip6.h presence... yes checking for netinet/ip6.h... yes configure: creating ./config.status config.status: creating Makefile config.status: creating scached.conf config.status: creating config.h config.status: executing depfiles commands
munlap:~/BUILD/scache-0.99.0$ make echo "#define SCACHED_SOCK \"/usr/local/scached/var/scached.sock\"" > \ ext/php-scache-paths.h (cd ext && phpize && ./configure) Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc ....(snip).... ---------------------------------------------------------------------- Libraries have been installed in: /home/juhar/BUILD/scache-0.99.0/ext/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. make: Leaving directory `/home/juhar/BUILD/scache-0.99.0/ext' make: Leaving directory `/home/juhar/BUILD/scache-0.99.0'
And finally install :
munlap:~/BUILD/scache-0.99.0$ sudo make install make install-recursive make: Entering directory `/home/juhar/BUILD/scache-0.99.0' Making install in . make: Entering directory `/home/juhar/BUILD/scache-0.99.0' make: Entering directory `/home/juhar/BUILD/scache-0.99.0' test -z "/usr/local/scached/var" || /bin/mkdir -p "/usr/local/scached/var" test -z "/usr/local/scached/sbin" || /bin/mkdir -p "/usr/local/scached/sbin" /usr/bin/install -c scached '/usr/local/scached/sbin' test -z "/usr/local/scached/etc" || /bin/mkdir -p "/usr/local/scached/etc" /usr/bin/install -c -m 644 scached.conf '/usr/local/scached/etc' make: Nothing to be done for `install-data-am'. make: Leaving directory `/home/juhar/BUILD/scache-0.99.0' make: Leaving directory `/home/juhar/BUILD/scache-0.99.0' Making install in ext make: Entering directory `/home/juhar/BUILD/scache-0.99.0/ext' Installing shared extensions: /usr/lib/php5/20090626/ make: Leaving directory `/home/juhar/BUILD/scache-0.99.0/ext' make: Leaving directory `/home/juhar/BUILD/scache-0.99.0'
Please note, that extension module (ext/.libs/scache.so) installs outside of specified --prefix directory to actual php extension directory. If you are cautious by default, make -k install without sudo and copy scache.so by hand from ext/.libs/scache.so to php module directory.
Configure scripts supports also some extra parameters :
- --enable-extended-stats enables extra statistics collection and larger scache_srvstats output at slight cost of speed.
- --disable-nodes-accounting and --disable-memory-accounting disables tracking memory and node usage respectively. Disabling tracking disables also possibility to limit resources usage per session but might provide tiny speedup.
- --enable-full-partitioning makes possible to pick up sessions into different partitions with different resource limits and configuration with slight cost in speed.
In practice, speedup gained by tuning functionality down is some 2-3 percent.
To enable php extension, you need to enable module on php.ini with directive :
You might need to tweak some configuration, but program should work out of the box. There is test-scripts on extension directory on source tree.
Scached works without root privileges as long as it can create and bind the builtin (or scached.conf -changed) unix socket path and tcp port. If invoked as root, it drops its privileges once initialization is done.
After installing php extension you probably need to restart your apache server.
.deb -based distributions (debian, ubuntu)
Just compile it with :
host:~/BUILD/scache-0.90.7$ fakeroot ./debian/rules binary
..and install with dpkg -i resulting packages.