Between izx's answer, 32bitfloat's comment and a bit of googling, I got this working (on Ubuntu 12.04 LTS). Here's exactly what I had to do. All these commands are as root, and some details may be different on your setup.
Preparation
First, clear out any traces of existing ClamAV:
aptitude install zlib1g-dev php5-dev
aptitude purge clamav clamav-base clamav-data clamav-docs clamav-freshclam libclamav6
Install ClamAV
Download the latest ClamAV, make and install it:
wget http://downloads.sourceforge.net/clamav/clamav-0.98.4.tar.gz
tar xzf clamav-0.98.4.tar.gz
cd clamav-0.98.4
./configure
make
make install
ldconfig
Make freshclam work and run it:
useradd clamav
mkdir /usr/local/share/clamav
chown clamav /usr/local/share/clamav
cp /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf
Edit the file /usr/local/etc/freshclam.conf
and comment out the line that says Example
. Then update:
freshclam
If that ran successfully, test it works by scanning a file:
clamscan somefile
Install PHP-ClamAV
Download the latest PHP-ClamAV, make and install it:
wget https://launchpad.net/php-clamav/trunk/0.15.7/+download/php-clamav_0.15.7.tar.gz
tar xzf php-clamav_0.15.7.tar.gz
cd php-clamav_0.15.7
phpize
./configure --with-clamav
make
make install
Install into Apache and restart:
echo "extension=clamav.so" > /etc/php5/conf.d/clamav.ini
service apache2 restart
I hope that lot's useful to somebody. I really wish php-clamav
was still supported on Aptitude. It would be far nicer than the above.