Hi list !
I would support such a feature as well.
I am working on an implementation that would integrate PHAR support and
opcode cache binary files
(so that you could make a PHAR file that contains binary (opcode cache)
files)
I am voicing my opinion here because the current PHAR implementation
does not work with binary (opcode cache) files.
(The problem seems to be that the PHAR extension directly extracts/opens
the phar file directory, compiles the file into opcodes
and then executes them) - But compiling a file into opcodes that is
already a binary (opcode cache) file yields garbage...
So if this feature were to be implemented, the implementation would have
to (in my opinion) solve this problem in the PHAR
extension.
The way I have worked around this problem is to implement some extract
functions (require_once_bin(), require_bin(), include_bin() and
include_once_bin() and then make sure that autoloaders used in inside
the PHAR use those when reading from/including from that PHAR file that
contains opcode binary files.
/Henrik
On 01-Oct-20 12:36, Michał Marcin Brzuchalski wrote:
Hi,
czw., 1 paź 2020 o 11:36 肖 鑫鑫 <chopins.x...@live.com> napisał(a):
I commit a new request path, the request is about execution opcode file
without php source code file
this RFC provides similar to class file of java and pyo file of python.
patch is: https://github.com/php/php-src/pull/6146
I had exact the same feature in my mind and working implementation few
years ago
when PHP 7.0 appeared on horizon which didn't get a Zend Guard support.
I like the idea a lot.
One risk I see here is people putting whole framework or apps into one PHP
file before
calling `opcache_compile_file` to produce one big binary file.
Would it be possible to move this feature to separate function and pass
iterable list of files?
I am not sure if with current OPCache file format it's possible but if that
might reduce amount
of steps required to produce one huge OPCache file which then can be loaded
by interpreter.
Second thing worth of noting is that PR examples use CLI SAPI and lacks of
examples how
FPM can load it. Would it require at least an index.php with `<?php include
'myapp.bin';` ?
Cheers,
Michał Marcin Brzuchalski
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php