Tag search
Scanning files with ClamAV from CakePHP
by Sander MarechalOne of the requirements for the upcoming public release of Officeshots.org is that all uploaded files are run through a virus scanner before they are made available. Picking a virus scanner for this job was easy. ClamAV is open source, well supported, actively maintained and comes pre-packaged for Debian Lenny which we use for the Officeshots servers. Finding a PHP library to interact with ClamAV proved harder though. The 3rd party library page for ClamAV points to two different libraries that provide PHP bindings for ClamAV but both appear to be dead and expunged from the internet. So, I created my own using the clamd TCP API, and because Officeshots is built using CakePHP I implemented it as a Cake plugin.
You can download the clamd-0.1.tar.gz plugin or check out the source from my Subversion repository with the following command:
~$ svn checkout https://svn.jejik.com/cakephp/plugins/clamd/trunk clamd
Or you can browse the repository online. In the rest of this article I will show you how you can use this plugin.