Hi !
I hope this is the right mailing list to post my request to.
I found a port of bcompiler here:
https://github.com/vjardin/bcgen/
which is PHP7 compatible.
By mailing here, I am trying to reach out to the authors of the PHAR
extension since the author(s) of bcgen have said that they don't know
enough about the PHAR extension.
I am trying to get bcgen to work with PHAR files. I have added the
compiled PHP files to the PHAR file (using their PHP extension within
the PHAR file)
The stub of the PHP archive is:
|#!/usr/bin/env php|
|<?php|
|Phar::mapPhar( 'app.phar' );|
|set_include_path( 'phar://app.phar' . PATH_SEPARATOR.';.');|
|require('phar://' . __FILE__ . '/app.php');|
|__HALT_COMPILER(); |?>
The file app.php is in the root of the PHAR archive and is compiled by
bcgen.
When I run the phar (on the commandline), all I get is some gibberish
output (to STDOUT) and the process exits with exitcode 130 ?
My understanding is that bcgen extension will inspect the file which is
included/required (ie. app.php) and then - if it is bytecode - then
simply execute the bytecode - If it is not, then it will parse the
included file normally ? (from the description found in the README of
bcgen in github)
However it seems that what actually happens, is that the header of the
PHAR file itself is checked and since that is obviously not a BCGEN
header or a normal PHP file, processing is aborted.
If we could skip this check when running from a PHAR archive (from the
commandline or when the PHAR is included within some other PHP file) and
in this scenario only "react" to include/require/autoloading statements
(ie. check if a file that is about to be included is bytecode or not -
if it is, then run it - If it is not then compile it first and then run
the resulting bytecode), then - in my humble opinion - we would have a
way of adding minimal protection to PHAR files - useful when
redistributing PHARs (since such a PHAR archive would then simply
contain a number of files that are bytecode - except for the stub of
course...) and that would - I think - make PHAR files even cooler and
provide a most sought-after feature.
Could anyone help getting "PHAR support" to work with the bcgen
extension ? I would be willing to help but my C skills are not that
great and I know little about the ZendEngine.
Thanks in advance !
Best regards,
Henrik Skov
Secuno A/S
www.secuno.dk