diff --git a/core/CliMulti.php b/core/CliMulti.php
index ea1bcf99ba710fd07235fc7a970d3833f6e91350..97611768f6eecbb49be954bcb0e702f2cc91c661 100644
--- a/core/CliMulti.php
+++ b/core/CliMulti.php
@@ -54,11 +54,13 @@ class CliMulti {
 
         do {
             usleep(100000); // 100 * 1000 = 100ms
-        } while ($this->supportsAsync && !$this->isFinished());
+        } while (!$this->isFinished());
 
         $results = $this->getResponse($piwikUrls);
         $this->cleanup();
 
+        self::cleanupNotRemovedFiles();
+
         return $results;
     }
 
@@ -79,14 +81,9 @@ class CliMulti {
             $output = new Output($cmdId);
 
             if ($this->supportsAsync) {
-                $this->processes[] = new Process($cmdId);
-
-                $query   = $this->getQueryFromUrl($url, array('pid' => $cmdId));
-                $command = $this->buildCommand($query, $output->getPathToFile());
-                shell_exec($command);
+                $this->executeAsyncCli($url, $output, $cmdId);
             } else {
-                $response = Http::sendHttpRequestBy('curl', $url, $timeout = 0, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $this->acceptInvalidSSLCertificate);
-                $output->write($response);
+                $this->executeNotAsyncHttp($url, $output);
             }
 
             $this->outputs[] = $output;
@@ -116,8 +113,10 @@ class CliMulti {
     private function buildCommand($query, $outputFile)
     {
         $appendix = $this->supportsAsync ? ' > ' . $outputFile . ' 2>&1 &' : '';
+        $bin      = $this->getPhpBinary();
 
-        return PIWIK_INCLUDE_PATH . '/console climulti:request ' . escapeshellarg($query) . $appendix;
+        return sprintf('%s %s/console climulti:request %s %s',
+                       $bin, PIWIK_INCLUDE_PATH, escapeshellarg($query), $appendix);
     }
 
     private function getResponse()
@@ -133,7 +132,7 @@ class CliMulti {
 
     private function isFinished()
     {
-        foreach ($this->processes as $process) {
+        foreach ($this->processes as $index => $process) {
             $hasStarted = $process->hasStarted();
 
             if (!$hasStarted && 8 <= $process->getSecondsSinceCreation()) {
@@ -149,6 +148,11 @@ class CliMulti {
             if ($process->isRunning()) {
                 return false;
             }
+
+            if ($process->hasFinished()) {
+                // prevent from checking this process over and over again
+                unset($this->processes[$index]);
+            }
         }
 
         return true;
@@ -165,7 +169,7 @@ class CliMulti {
      */
     private function supportsAsync()
     {
-        return !SettingsServer::isWindows() && Process::isSupported();
+        return !SettingsServer::isWindows() && Process::isSupported() && $this->getPhpBinary();
     }
 
     private function cleanup()
@@ -182,14 +186,65 @@ class CliMulti {
         $this->outputs   = array();
     }
 
-    public static function cleanupAllNotRemovedFiles()
+    /**
+     * Remove files older than one week. They should be cleaned up automatically after each request but for whatever
+     * reason there can be always some files left.
+     */
+    public static function cleanupNotRemovedFiles()
     {
+        $timeOneWeekAgo = strtotime('-1 week');
+
         foreach (_glob(PIWIK_INCLUDE_PATH . '/tmp/climulti/*') as $file) {
             $timeLastModified = filemtime($file);
 
-            if (time() - $timeLastModified > 1000) {
+            if ($timeOneWeekAgo > $timeLastModified) {
                 unlink($file);
             }
         }
     }
+
+    private function getPhpBinary()
+    {
+        if (defined('PHP_BINARY')) {
+            return PHP_BINARY;
+        }
+
+        $bin = shell_exec('which php');
+
+        if (empty($bin)) {
+            $bin = shell_exec('which php5');
+        }
+
+        if (!empty($bin)) {
+            return trim($bin);
+        }
+    }
+
+    private function executeAsyncCli($url, Output $output, $cmdId)
+    {
+        $this->processes[] = new Process($cmdId);
+
+        $query   = $this->getQueryFromUrl($url, array('pid' => $cmdId));
+        $command = $this->buildCommand($query, $output->getPathToFile());
+
+        shell_exec($command);
+    }
+
+    private function executeNotAsyncHttp($url, Output $output)
+    {
+        try {
+            $response = Http::sendHttpRequestBy('curl', $url, $timeout = 0, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $this->acceptInvalidSSLCertificate);
+            $output->write($response);
+        } catch (\Exception $e) {
+            $message = "Got invalid response from API request: $url. ";
+
+            if (empty($response)) {
+                $message .= "The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.";
+            } else {
+                $message .= "Response was '" . $e->getMessage() . "'";
+            }
+
+            $output->write($message);
+        }
+    }
 }
diff --git a/tests/PHPUnit/Integration/Core/CliMultiTest.php b/tests/PHPUnit/Integration/Core/CliMultiTest.php
index 727b64d70ecc03cf38146aa7ef01e8051dfd4678..ea90020e923ff3d4e312161e0f8ffbc43d777c4e 100644
--- a/tests/PHPUnit/Integration/Core/CliMultiTest.php
+++ b/tests/PHPUnit/Integration/Core/CliMultiTest.php
@@ -7,8 +7,7 @@
  */
 
 use \Piwik\Version;
-use \Piwik\Common;
-use \Piwik\Url;
+use \Piwik\CliMulti;
 
 /**
  * Class Core_CliMultiTest
@@ -41,7 +40,7 @@ class Core_CliMultiTest extends IntegrationTestCase
     {
         parent::setUp();
 
-        $this->cliMulti  = new \Piwik\CliMulti();
+        $this->cliMulti  = new CliMulti();
         $this->authToken = Test_Piwik_BaseFixture::getTokenAuth();
 
         $this->urls = array(
@@ -145,6 +144,33 @@ class Core_CliMultiTest extends IntegrationTestCase
         $this->assertRequestReturnsValidResponses($urls, array('getPiwikVersion', 'getAnswerToLife', 'getPiwikVersion'));
     }
 
+    public function test_cleanupNotRemovedFiles_shouldOnlyRemoveFiles_IfTheyAreOlderThanOneWeek()
+    {
+        $timeOneWeekAgo = strtotime('-1 week');
+
+        // make sure -1 week returns a timestamp one week ago
+        $this->assertGreaterThan(604797, time() - $timeOneWeekAgo);
+        $this->assertLessThan(604803, time() - $timeOneWeekAgo);
+
+        $tmpDir = PIWIK_INCLUDE_PATH . '/tmp/climulti/';
+        touch($tmpDir . 'now.pid');
+        touch($tmpDir . 'now.output');
+        touch($tmpDir . 'toberemoved.pid', $timeOneWeekAgo - 10);
+        touch($tmpDir . 'toberemoved.output', $timeOneWeekAgo - 10);
+        touch($tmpDir . 'toBeNotRemoved.pid', $timeOneWeekAgo + 10);
+        touch($tmpDir . 'toBeNotRemoved.output', $timeOneWeekAgo + 10);
+
+        CliMulti::cleanupNotRemovedFiles();
+
+        $this->assertFileExists($tmpDir . 'now.pid');
+        $this->assertFileExists($tmpDir . 'now.output');
+        $this->assertFileExists($tmpDir . 'toBeNotRemoved.output');
+        $this->assertFileExists($tmpDir . 'toBeNotRemoved.output');
+
+        $this->assertFileNotExists($tmpDir . 'toberemoved.output');
+        $this->assertFileNotExists($tmpDir . 'toberemoved.output');
+    }
+
     private function assertRequestReturnsValidResponses($urls, $expectedResponseIds)
     {
         $actualResponse = $this->cliMulti->request($urls);