First, you may need a few tools I, myself, were missing on my server. To compile it, I had to install php-devel, openssl, and openssl-devel. We also need clamav-devel to compile php-clamav with. To determine what I needed for php-devel, I did:
yum list installed | grep php
This told me I needed the php56w version, as that is what my server is running (PHP 5.6). So, to be able to add php-clamav, I did the following:
yum install php56w-devel openssl openssl-devel clamav-devel service httpd restart
Next, download the source of the php-clamav tool. This can be found here: http://sourceforge.net/projects/php-clamav/
Now we need to extract the source and compile it.
tar zxvf php-clamav_0.15.8.tar.gz cd php-clamav-0.15.8/ phpize ./configure make make install
If all is well, you should have a file like the following:/usr/lib64/php/modules/clamav.so
If you get make errors, check and see where it failed. You may have dependencies that are missing. This was the case for me. I was missing openssl and openssl-devel, which is needed by the make call.
Now you need to tell PHP to use this file.
in the ; Dynamic Extensions ; section of the file. It can really go anywhere in the file (I believe). I just like to put it where it’s described.
Finally, restart Apache:
service httpd restart
Now, you should have access to the various php-clamav functions within your scripts.
Hope this helps!