php - clamav cl_scanfile takes a long time to finish -


how optimize clamav cl_scanfile faster? on average takes 15-20 seconds scanning file. if in 1 form have 2 upload field, take 40 seconds or more, cause php max execution time error.

i rather not change execution time of php.

is there anyway this?

my code this:

function upload() { ...         // checking element type based on element id.         // if element type == file, check file type. based on result, halt (redirect failure) or continue         foreach ($this->_controller->data['formsubmission'] $elementid => $fieldvalue) { ... ...                         //checking file virus                         $retcode = cl_scanfile($fieldvalue["tmp_name"], $virus_name);                          //if virus not found                         if ($retcode != cl_virus) {                             //check directory if uploadpath not directory, make                             if (!is_dir($uploadpath)) {                                 mkdir($uploadpath, 0777, true);                             }                              //filename                             $now = date('ymd-his');                             $filename = $now . '-' . $elementid . $fieldvalue["name"];                              $fullfilepath = $uploadpath . '/' . $filename;                             $uploading = move_uploaded_file($fieldvalue["tmp_name"], $fullfilepath);                             // change value uploadpath ul/dl                             $this->_controller->data["formsubmission"][$elementid] = $fullfilepath;                         } else {                             //if virus found, don't upload                             $this->_controller->data["formsubmission"][$elementid] = "";                         } 

got time down 1/2 adding
clamav.load_db_on_startup=1 /etc/php5/mods-available/clamav.ini

extension=clamav.so [clamav] clamav.dbpath="/usr/local/share/clamav" clamav.load_db_on_startup=1 clamav.maxreclevel=16 clamav.maxfiles=10000 clamav.maxfilesize=26214400 clamav.maxscansize=104857600 clamav.keeptmp=0 clamav.tmpdir="/tmp" 

still takes around 7-8 seconds, depending on file size.

http://php-clamav.sourceforge.net/parameters.php#load_db_on_startup


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -