Author Topic: Avast and PHP exec() issue  (Read 7869 times)

0 Members and 1 Guest are viewing this topic.

darktemplarcs

  • Guest
Avast and PHP exec() issue
« on: July 14, 2008, 03:37:20 PM »
Hey,

Here is an issue I encountered, hope someone can shred some light. I am trying to execute avast to scan files user upload to my web application. I have Avast running in my Ubuntu and and I using the exec() function in PHP to execute avast. And this is the error message I am keep getting:

Couldn't find a registration key in ~/.avast/avastrc file!
Please register avast! at http://www.avast.com/i_kat_207.php?lang=ENG
to get the key.
NOTE: if avast! rejects the key, remove ~/.avast/avastrc file and
run this script again with a valid key.

Please enter the key here:

Base virus definition file installed.
Please run 'avast-update' to download the latest available.


I did some research and found this thread but... it appears to work for Cron only: http://forum.avast.com/index.php?action=printpage;topic=20502.0

The weird thing is that the program  work flawlessly through the Terminal. Anyone? Big thanks!

Offline zilog

  • Avast team
  • Advanced Poster
  • *
  • Posts: 957
  • or #f0; daa; add a,#a0; adc a,#40
Re: Avast and PHP exec() issue
« Reply #1 on: July 16, 2008, 02:09:29 PM »
Hey,

Here is an issue I encountered, hope someone can shred some light. I am trying to execute avast to scan files user upload to my web application. I have Avast running in my Ubuntu and and I using the exec() function in PHP to execute avast. And this is the error message I am keep getting:

Couldn't find a registration key in ~/.avast/avastrc file!
Please register avast! at http://www.avast.com/i_kat_207.php?lang=ENG
to get the key.
NOTE: if avast! rejects the key, remove ~/.avast/avastrc file and
run this script again with a valid key.

Please enter the key here:

Base virus definition file installed.
Please run 'avast-update' to download the latest available.


I did some research and found this thread but... it appears to work for Cron only: http://forum.avast.com/index.php?action=printpage;topic=20502.0

The weird thing is that the program  work flawlessly through the Terminal. Anyone? Big thanks!

Probably, the PHP process that tries to execute the scanner runs under different UID, where's no key available in his homedir.
Just run the PHP under the desired user, or install avast's key for the PHP-user, or use avastcmd which dowsn't require key at all (part of avast4server package).

regards
pc
May's Law: Software efficiency halves every 18 months, compensating Moore's Law. (David May, INMOS)

darktemplarcs

  • Guest
Re: Avast and PHP exec() issue
« Reply #2 on: July 17, 2008, 03:12:09 PM »
by copying the whole .avast directory to the www directory, it worked! :) thanks!