PHP ClamAV Lib

Attos attos.janus at
Mon Dec 3 06:49:31 PST 2007

You can execute ClamAV from PHP and parse the result.
The exec() function can do the job. This is the description from the PHP manual:

(PHP 3, PHP 4, PHP 5)

exec -- Execute an external program
string exec ( string command [, array &output [, int &return_var]] )

exec() executes the given command.


The command that will be executed.

If the output argument is present, then the specified array will be
filled with every line of output from the command. Trailing
whitespace, such as \n, is not included in this array. Note that if
the array already contains some elements, exec() will append to the
end of the array. If you do not want the function to append elements,
call unset() on the array before passing it to exec().

If the return_var argument is present along with the output argument,
then the return status of the executed command will be written to this

Return Values
The last line from the result of the command. If you need to execute a
command and have all the data from the command passed directly back
without any interference, use the passthru() function.

To get the output of the executed command, be sure to set and use the
output parameter.

Example 1. An exec() example

// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');

On Dec 1, 2007 1:30 PM, Matthew Seaman <m.seaman at> wrote:
> Hash: SHA256
> jekillen wrote:
> > Hello:
> > I am looking for PHP ClamAV Lib
> > in ports and I do not know of hand
> > where to find it.  I did not find it in
> > /usr/ports/security. And if it exists in
> > ports, what would it be called for a
> > find command?
> > My aim is to use it for scanning files
> > uploaded to web sites in php scripts.
> > I installed ClamAV,  Amavisd-new,
> > and Cyrus-sasl-saslauthd
> > from /usr/ports/security.
> > FreeBSD v 6.2
> > Thanks in advance
> > Jeff K
> Unfortunately it seems that you are not in luck.  There does
> not appear to be a PHP related ClamAV module in the ports.  Apache,
> Perl or python, yes.  PHP, no.
> happy-idiot-talk:/usr/ports:% make search name=clamav display=name,path
> Port:   p5-Mail-ClamAV-0.20
> Path:   /usr/ports/mail/p5-Mail-ClamAV
> Port:   clamav-0.91.2_1
> Path:   /usr/ports/security/clamav
> Port:   clamav-devel-20071011
> Path:   /usr/ports/security/clamav-devel
> Port:   p5-File-Scan-ClamAV-1.8_1
> Path:   /usr/ports/security/p5-File-Scan-ClamAV
> Port:   py25-clamav-0.4.0_1
> Path:   /usr/ports/security/py-clamav
> Port:   mod_clamav-0.21_1
> Path:   /usr/ports/www/mod_clamav
> Perhaps you could view this as your chance to contribute something
> back to the project.  Take a gander at the Porter's Handbook --
> and look at some of the proir art already in the ports system and
> see if you can't put together a pecl-clamav or pear-ClamAV port.
> Submit it via send-pr so that all can share.
>         Cheers,
>         Matthew
> - --
> Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
>                                                   Flat 3
> PGP:     Ramsgate
>                                                   Kent, CT11 9PW
> Version: GnuPG v2.0.4 (FreeBSD)
> Comment: Using GnuPG with Mozilla -
> iD8DBQFHUahK8Mjk52CukIwRCGhQAJ4zey/5RU44g2sYGpSg12GYJeSITACePjOH
> UQOX7vLvDVuk5nRchPyWBR4=
> =gW4S
> _______________________________________________
> freebsd-ports at mailing list
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe at"

Attos Janus

More information about the freebsd-ports mailing list