First download, build and install clamav. I found that Debian Squeeze’s clamav in the apt package was not detected by the php-clamav installation script.
wget http://downloads.sourceforge.net/clamav/clamav-0.97.6.tar.gz tar -xvvf clamav-0.97.6.tar.gz cd clamav-0.97.6 ./configure make make install
Now download , build and install php-clamav
wget http://nchc.dl.sourceforge.net/project/php-clamav/0.15/php-clamav_0.15.7.tar.gz tar -xvvf php-clamav_0.15.7.tar.gz cd php-clamav-0.15.7/ phpize ./configure --with-clamav make make install
Once installed, you need to enable php-clamav.
First edit the clamav configuration file:
Read the file and set your options. At the bare minimum, you need to comment out this line:
So it reads this:
Now run clamscan and test that it works:
[[email protected]] /etc/php5/conf.d #clamdscan -V ClamAV 0.97.6
If there’s an issue with the configuration, at this point it will notify you to correct it. If everything is alright, it will report the version.
Now you need to setup so that clamav php extension loads up whenever the web server is loaded.
Create a new text file in /etc/php5/conf.d/clamav.ini with the following content:
Now restart apache2 on the webserver and load a php file with the function phpinfo (assuming it is enabled on your server of course). You can confirm that the extension is loaded by the fact that phpinfo reports a whole new section for clamav (Just use the search option on the page).