public function getPhantomJsVersionFromBinary($pathToBinary)
    {
        $io = $this->getIO();

        try {
            $cmd = escapeshellarg($pathToBinary) . ' -v';
            exec($cmd, $stdout);
            $version = $stdout[0];
            return $version;
        } catch (\Exception $e) {
            $io->warning("Caught exception while checking PhantomJS version:\n" . $e->getMessage());
            $io->notice('Re-downloading PhantomJS');
            return false;
        }
    }