I'd like to automatically scan uploaded files for viruses with php. There was an extension called php-clamavlib in earlier versions of ubuntu, but on Natty I get
E: Unable to locate package php5-clamavlib
Isn't there any extension anymore? What could I do to archive this?
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:
Install ClamAV
Download the latest ClamAV, make and install it:
Make freshclam work and run it:
Edit the file
/usr/local/etc/freshclam.conf
and comment out the line that saysExample
. Then update:If that ran successfully, test it works by scanning a file:
Install PHP-ClamAV
Download the latest PHP-ClamAV, make and install it:
Install into Apache and 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.php-clamav
tarball from Launchpad.php5-dev
,clamav
if you haven't already withsudo apt-get
Extract the tarball,
cd
into the php-clamav-xxxx directory, and follow these steps to install the php-clamav module (adapted fromINSTALL
):