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 :

Building and installing

Unpack the archive :

munlap:~/BUILD$ tar -xjf scache-0.99.0.tar.bz2 
munlap:~/BUILD$ cd scache-0.99.0

Configure :

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

Build :

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[2]: Leaving directory `/home/juhar/BUILD/scache-0.99.0/ext'
make[1]: 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[1]: Entering directory `/home/juhar/BUILD/scache-0.99.0'
Making install in .
make[2]: Entering directory `/home/juhar/BUILD/scache-0.99.0'
make[3]: 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[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/juhar/BUILD/scache-0.99.0'
make[2]: Leaving directory `/home/juhar/BUILD/scache-0.99.0'
Making install in ext
make[2]: Entering directory `/home/juhar/BUILD/scache-0.99.0/ext'
Installing shared extensions:     /usr/lib/php5/20090626/
make[2]: Leaving directory `/home/juhar/BUILD/scache-0.99.0/ext'
make[1]: 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 :

In practice, speedup gained by tuning functionality down is some 2-3 percent.

Setup

To enable php extension, you need to enable module on php.ini with directive :

extension=scache.so

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.