diff --git a/src/phpDocumentor/PharCompiler.php b/src/phpDocumentor/PharCompiler.php
index <HASH>..<HASH> 100644
--- a/src/phpDocumentor/PharCompiler.php
+++ b/src/phpDocumentor/PharCompiler.php
@@ -197,8 +197,11 @@ class PharCompiler
      */
     protected function getCliStub()
     {
-        return "<?php " . $this->getLicense()
-            . " require_once __DIR__.'/bin/phpdoc.php'; __HALT_COMPILER();";
+        return <<<'PHP'
+#!/usr/bin/env php
+<?php
+require_once __DIR__.'/bin/phpdoc.php'; __HALT_COMPILER();
+PHP;
     }
 
     /**
@@ -208,9 +211,12 @@ class PharCompiler
      */
     protected function getWebStub()
     {
-        return "<?php " . $this->getLicense()
-            . "throw new \LogicException('This PHAR file can only be used from "
-            ."the CLI.'); __HALT_COMPILER();";
+        return <<<'PHP'
+#!/usr/bin/env php
+"<?php
+throw new \LogicException('This PHAR file can only be used from the CLI.');
+__HALT_COMPILER();
+PHP;
     }
 
     /**
Add shebang for Phar file to enable +x