Re: Support for writing and executing compiled opcode
| From: | Rasmus Lerdorf | Date: | Sun, 15 Nov 2015 00:03:24 +0000 |
| Subject: | Re: Support for writing and executing compiled opcode | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89217@lists.php.net to get a copy of this message | ||
On Nov 13, 2015, at 21:32, Stephen Coakley <me@stephencoakley.com> wrote:
>
>> On 11/13/2015 05:46 PM, Rasmus Lerdorf wrote:
>>> On Nov 13, 2015, at 17:00, Stephen Coakley <me@stephencoakley.com> wrote:
>>>
>>>>> On 11/13/2015 03:45 PM, Sebastian Bergmann wrote:
>>>>> On 11/13/2015 04:35 PM, Stephen Coakley wrote:
>>>>> This is quite similar to Python's ability to execute Python scripts
>>>>> compiled to bytecode as *.pyc files. The feature has seen great
>>>>> success in
>>>>> Python, mostly for distributing releases of software or deploying to a
>>>>> server.
>>>>
>>>> Correct me if I'm wrong, but this should already be possible with OpCache
>>>> and its filesystem backend in PHP 7.0.
>>>>
>>>> See http://talks.php.net/froscon15#/php7pcache1
>>>> and following for
>>>> details.
>>>
>>> That's great! That's about halfway toward what I'm looking for. That
>>> means that the engine is likely already capable of doing these things -- the next step is to be able
>>> to execute any given .php.bin file like in that talk. The idea would be to be able to bypass the
>>> caching mentality by executing an already compiled file, instead of checking if the original .php
>>> file has a corresponding bin file in the cache
>>
>> You could simply deploy both the .php and the .bin files to achieve this today.
>>
>> -Rasmus
>
> Would the bin files not have to be placed in the special OPcache file store location though?
> That seems sub-optimal.
But that is just a matter of copying the .bin files into a configurable directory. However, as
others have said, this is completely pointless. If you are worried about initial compile latency on
initial requests after a deeply of new code then simply run a couple of warmup requests before
flipping your symlink to the new code. Beyond that I can't picture what possible use this could
be. Hiding source code? No chance, getting PHP code from bytecode is trivial.
-Rasmus
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s