3 * Phar stub file for stapibas. Handles startup of the .phar file.
10 * @copyright 2014 Christian Weiske
11 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12 * @link http://cweiske.de/bdrem.htm
14 if (!in_array('phar', stream_get_wrappers()) || !class_exists('Phar', false)) {
15 echo "Phar extension not avaiable\n";
19 $web = 'www/index.php';
20 $cli = 'bin/phar-stapibas.php';
23 * Rewrite the HTTP request path to an internal file.
24 * Maps "" and "/" to "www/index.php".
26 * @param string $path Path from the browser, relative to the .phar
28 * @return string Internal path.
30 function rewritePath($path)
32 if ($path == '' || $path == '/') {
33 return 'www/index.php';
38 //Phar::interceptFileFuncs();
41 . PATH_SEPARATOR . 'phar://' . __FILE__ . '/lib/'
43 Phar::webPhar(null, $web, null, array(), 'rewritePath');
45 //work around https://bugs.php.net/bug.php?id=52322
46 if (php_sapi_name() == 'cgi-fcgi') {
47 echo "Your PHP has a bug handling phar files :/\n";
51 require 'phar://' . __FILE__ . '/' . $cli;