Installing memcached And The PHP5 On Debian Etch (Apache2)

I have tested this on a Debian Etch server where Apache2 and PHP5 are already installed and working.

host-colorpack.net:~/root#  apt-get install memcached php5-memcache

server1:~# netstat -tap | grep memcached
tcp        0      0 *:11211                 *:*                     LISTEN     3053/memcached
host-colorpack.net:~/root#

host-colorpack.net:~/root#  vi /etc/memcached.conf

[...]
# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
# -l 12.34.56.78
-l 127.0.0.1
[...]

host-colorpack.net:~/root#  /etc/init.d/memcached restart

... and run

netstat -tap | grep memcached

again. As you see, memcached is now listening on localhost only:

server1:~# netstat -tap | grep memcached
tcp        0      0 localhost.localdo:11211 *:*                     LISTEN     3092/memcached
server1:~#

Afterwards, we restart Apache so that our new PHP configuration takes effect:

/etc/init.d/apache2 restart