In case anybody tries to import keys from file and ends up with return value "false", and absolutely no errors or warnings whatsoever.
gpg module still operates the same way as command line / bash invoked gpg.
If you are runnig a script from under apache, gpg is trying to acces it's ~/.gnupg that likely does not exist for apache user www-data or equivalent:
# su www-data -s /bin/bash -c "gpg"
gpg: Fatal: can't create directory '/var/www/.gnupg': Permission denied
You simply need to created that folder and chown it to apache user www-data or equivalent.
# mkdir /var/www/.gnupg
# chown www-data:www-data /var/www/.gnupg