php - Error Packaging into a Phar file an entire Slim Application -


i have slim application following directory structure:

app/ vendor/ www/  config.php 

in app/ have relevant files of project, in vendor/ dependencies managed composer , in www/ files accesible web server.

so thinking create phar file along lines of:

<?php  $full_path = '/home/.../forms/'; $package_name = 'www/package.phar';  try {     $phar = new phar($full_path . $package_name,      filesystemiterator::current_as_fileinfo |       filesystemiterator::key_as_filename, $full_path . $package_name);  $phar->startbuffering();  $phar->addfile($full_path . 'www/index.php'); $phar->addfile($full_path . 'www/bootstrap.php'); $phar->addfile($full_path . 'www/session_start.php');   // grab config $phar->addfile($full_path . 'config.php');   $phar->buildfromiterator(new recursiveiteratoriterator (new recursivedirectoryiterator('../app', filesystemiterator::skip_dots)),'../app'); $phar->buildfromiterator(new recursiveiteratoriterator (new recursivedirectoryiterator('../vendor', filesystemiterator::skip_dots)),'../vendor');  $phar->setdefaultstub('bootstrap.php', 'bootstrap.php');  $phar->stopbuffering();  echo "phar created.";  } catch (exception $e) { // handle errors here echo $e->getmessage(); } 

so create way phar , have:

deploy.php

<?php  require_once 'phar://package.phar/bootstrap.php'; $app->run(); 

but when accesing /deploy.php getting:

[fri may 15 20:07:02 2015] [error] [client 10.0.2.2] php warning: require_once(phar://package.phar/bootstrap.php) [function.require-once]: failed open stream: cannot open archive "/vagrant/www/package.phar", invalid alias in /vagrant/www/deploy.php on line 3 [fri may 15 20:07:02 2015] [error] [client 10.0.2.2] php fatal error: require_once() [function.require]: failed opening required 'phar://package.phar/bootstrap.php' (include_path='.:/usr/share/php:/usr/share/pear') in /vagrant/www/deploy.php on line 3

do think should addressing this?

thanks

edit:

"creating phar in shared folder of vagrant box caused problem. once changed "output" property location outside shared folder error went away." source


you should check php.ini: phar.require_hash = off

or sign phar setsignaturealgorithm()

or phing: <pharpackage ... signature="sha512"> ...


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -