Need help with installation on RedHat Enterprise Linux 4. Installation steps taken:
As per the install doc on the download, here is the installation steps for making the .so file:
# tar -xvzf php-clamav_0.15.3.tar.gz
# cd php-clamav-0.15.3
# phpize
# ./configure --with-clamav
# make
# cp modules/clamav.so /usr/local/lib/php/extensions/
# vi /usr/local/lib/php.ini
*added to the end of file*
extension=clamav.so
[clamav]
clamav.dbpath=/var/lib/clamav
clamav.maxreclevel=0
clamav.maxfiles=0
clamav.archivememlim=0
clamav.maxfilesize=0
clamav.maxratio=0
The dbpath indicated above did not exist so I manually created the directory (/var/lib/clamav).
# service httpd restart
phpinfo does not show the clamav extension nor does it's functions work on a test page. Can you help me?
You must have clamav installed on your system (minimal version : 0.95.x).
After, check your clamav virus database path (you can show that on configuration file in /etc/clamav/).
Change clamav.dbpath value by the correct path.
Next, restart apache
Thanks,
If doesn't work anymore, check your apache error log file (normally in /var/log/apache2/error.log or /var/log/httpd/error.log).
Tell me if it work or not.
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Oops, had the database path wrong. The config file was actually in /etc/clamd.conf. The current version is 0.96. The config file showed it as /var/clamav as the path and that is what I set it to.
I reloaded apache again, but still does not work. Here it the output and it also shows in the error_log in apache:
Fatal error: Call to undefined function cl_info() in /home/user/www/n.php on line 3
Ok, I think there is problem due to an wrong compilation.
Do you have any message on compilation ?
What is your version of PHP ?
Actually, I test and maintain php-clamav only on Debian/Ubuntu operating system.
But RedHat seem to be naturally compatible.
I'm interesting for help you because this permit to fix compilation procedure and stabilize build process on RedHat (and other derivate) operating system.
Thanks,
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
I didn't notice any error messages on the compilation. Of course when doing the ./configure and make commands, several things went across the screen, in the end it said it was completed. Our PHP version is 5.2.12. Would any other modules be conflicting? Our PHP is compiled with the Zend optimizer and Suhosin among others.
Your php.ini are in /usr/local/lib/ and not on /etc/php/ ... ?
Test this :
- Suppress your added lines into /usr/local/lib/php.ini
- Check the correct path of php.ini if not in /etc/php.
- Find the conf.d/ directory.
- Add the file clamav.ini with your your lines :
extension=clamav.so
[clamav]
clamav.dbpath="/var/clamav"
clamav.maxreclevel=16
clamav.maxfiles=10000
clamav.maxfilesize=26214400
clamav.maxscansize=104857600
clamav.keeptmp=0
clamav.tmpdir="/tmp"
- Check the correct extension path and put you clamav.so. (On Debian it's on : /usr/local/lib/php/extensions/)
- restart again you httpd server, and check if it work.
If doesn't work again, it's really a compilation problem, and I'm going to help you for that.
I have get some informations about php extensions on RedHat.
You must put a clamav.ini file in /etc/php.d/
And clamav.so file must be put into /usr/lib/php/modules/
Thanks,
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Yes, sorry I should have mentioned that the server uses cPanel so the paths may be different from the norm. php.ini is in /usr/local/lib.
/etc/php.d doesn't exist on our server and the only conf.d folder is in /usr/local/cpanel/3rdparty/etc/fonts/conf.d
In the php directory (/usr/local/lib/php) there is no modules directory, only extensions. So I don't have a place for a clamav.ini file.
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
I found another place to copy the extension to which is /usr/lib/php/extensions/ but even with copying it there and restarting apache still does not work...
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Success!! It turned out that I copied the clamav.so module to the wrong directory. Upon searching I found a page that mentioned how to find the active extensions directory. So I did:
# php-config --extension-dir
and it turned out the actual extension directory being used was
/usr/lib/php/extensions/no-debug-non-zts-xxxxxxxx
So I copied the clamav.so file there and reloaded apache and it works! Thank you very much for your help!!
Do the definitions update in realtime? Or is there any other action I have to do to maintain it?
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Well I am close anyways. I was testing an upload script with it and got an error:
Here is the if statement for the upload:
if($malware = cl_scanfile($_FILES['file']['tmp_name']))
$error .= 'We have Malware: '.$malware.'<br>ClamAV version: '.clam_get_version();
Error message is:
Warning: Wrong parameter count for cl_scanfile() in /home/acfeico/public_html/up.php on line 11
Good news :)
For maintain :
- If possible, you must have always the last version of clamav (0.96.1) and php-clamav (0.15.3).
- you must launch a "freshclam" to update clamav virus database (put a line for this in your crontab if it's not already the case).
- php-clamav reload the database regulary (it check the database stat and reload when it necessary).
Functions in php-clamav are differents to php-clamavlib.
You can go on http://php-clamav.sourceforge.net for look the correct use of functions or into phpclamav_test.php sample file distribute with source code.
If you are any problem with coding, please open a new support request.
I close this support request because you have find the solution.
Thanks.