diff --git a/misc/cron/archive.php b/misc/cron/archive.php
index fcf04d57c1351cdc73e5d78fa5dd11f1d9a36dbf..33efc8b319675811b4770674ff0595be8e23235d 100644
--- a/misc/cron/archive.php
+++ b/misc/cron/archive.php
@@ -42,7 +42,7 @@ See also: http://piwik.org/docs/setup-auto-archiving/
 \n\n";
 }
 
-if (isset($_SERVER['argv'])) {
+if (isset($_SERVER['argv']) && Piwik\Common::isPhpCliMode()) {
     $console = new Piwik\Console();
     $console->init();