PHP PHAR: Once again about creation of .phar in a proper way -



PHP PHAR: Once again about creation of .phar in a proper way -

i'm trying create phar archive executable stub. code:

<?php $phar = new phar('test.phar'); $phar->buildfromdirectory('files/'); $phar->setstub($phar->createdefaultstub(file_get_contents('st.php'), 'install.php')); ?>

the contents of "st.php" (the default stub):

#!/usr/bin/php <?php phar::mapphar(); include("phar://test.phar/install.php"); __halt_compiler();

inside "files" 1 file - "install.php"

<?php echo "the installer running right now."; ?>

phar compilation process runs no errors. when seek include created phar archive

include_once('phar://test.phar');

the error occurs:

php parse error: syntax error, unexpected ''#!/usr/bin/php\r' (t_encapsed_and_whitespace) in d:/webserver/domains/modinst/www/test.phar on line 110

the question is: how create phar archive utilize php resource can 'include'?

you cannot utilize shebang line within stub file. limitation of current php versions.

remove , error disappear.

php phar

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -