mjm7867 Posted November 14, 2006 Share Posted November 14, 2006 I am using clamAV(command line antivirus) on Centos 4.4, my problem is when i use clamscan on command line it works just fine and it gives me this on the terminal as an output: # clamscan text.txttext.txt: OK----------- SCAN SUMMARY -----------Known viruses: 76734Engine version: 0.90rc2Scanned directories: 0Scanned files: 1Infected files: 0Data scanned: 0.00 MBTime: 2.096 sec (0 m 2 s)when i run this command through php using this code:<?php$target_dir = "/var/www/html/webfileshare/";$file = basename($_FILES['uploaded']['name']);echo "<br><br>";$target_path = $target_dir. basename($_FILES['uploaded']['name']);$result = system("/usr/local/bin/clamscan $file");echo $result;if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";}else { echo "There was an error uploading the file, please try again!";}?>And i get the following output :----------- SCAN SUMMARY ----------- Known viruses: 76734 Engine version: 0.90rc2 Scanned directories: 0 Scanned files: 0 Infected files: 0 Data scanned: 0.00 MB Time: 1.834 sec (0 m 1 s) The file text.txt has been uploaded it uploads the file, but it doesn't scans it because it says "Scanned files: 0" in the summary also in the error log i get this message: ERROR: Can't access file text.txttext.txt: Permission deniedNeeed Help, thanks in advance!!-mjm Link to comment https://forums.phpfreaks.com/topic/27179-system-call-to-use-clamscan-on-php/ Share on other sites More sharing options...
trq Posted November 14, 2006 Share Posted November 14, 2006 You might want to move th efile first and then try and scan it. Link to comment https://forums.phpfreaks.com/topic/27179-system-call-to-use-clamscan-on-php/#findComment-124291 Share on other sites More sharing options...
mjm7867 Posted November 14, 2006 Author Share Posted November 14, 2006 Actually it works fine without supplying $file to system:but it scans the current directory that it is in,cuz i m trying to upload a file and want to scan it with clamav and then upload it to the permanent folder else delete from the tmp folder,so when i say:system("/usr/local/bin/clamscan");i get this :OK /var/www/html/webfileshare/php-vir-upload.php: OK /var/www/html/webfileshare/upload_check.php: OK /var/www/html/webfileshare/php-vir-upload.php~: OK /var/www/html/webfileshare/upload.php~: OK /var/www/html/webfileshare/schema.sql: OK /var/www/html/webfileshare/upload_check.php~: OK /var/www/html/webfileshare/upload.php: OK ----------- SCAN SUMMARY ----------- Known viruses: 76734 Engine version: 0.90rc2 Scanned directories: 1 Scanned files: 8 Infected files: 0 Data scanned: 0.00 MB Time: 2.009 sec (0 m 2 s) The file text.txt has been uploaded Link to comment https://forums.phpfreaks.com/topic/27179-system-call-to-use-clamscan-on-php/#findComment-124297 Share on other sites More sharing options...
mjm7867 Posted November 14, 2006 Author Share Posted November 14, 2006 But my problem is still not solved tho, cuz i want user to pick the file and upload it and that uploaded file would go to tmp and being scanned for viruses, the problem is i can't get the file to scan with viruses. Link to comment https://forums.phpfreaks.com/topic/27179-system-call-to-use-clamscan-on-php/#findComment-124306 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.