Allow tuning of PHP8 JIT settings (opcache.jit options in php.ini)
Issue
SlickStack seems to now support PHP8 PHP8 has a new JIT feature, but an option to tweak was not found in ss-config. https://php.watch/versions/8.0/JIT
Thanks @NathanAdhitya
opcache.enable=1 ;; ss = 1
opcache.enable_cli=1 ;; ss = 1
These are both hardcode enabled in SlickStack by default in the php.ini
https://github.com/littlebizzy/slickstack/blob/master/modules/php-fpm/8.1/php-ini.txt
However I'm not sure where this opcache.jit_buffer_size=256M option comes from because I didn't see it in the default php.ini files on the Ubuntu 22.04 boxes that I reviewed during 2022, so that's strange.
They also mention opcode.jit flags but not sure what that key/value is...
...okay actually, I just found this: https://php.watch/versions/8.4/opcache-jit-ini-default-changes
Prior to PHP 8.4, the default INI configuration values for PHP were:
opcache.jit=tracing opcache.jit_buffer_size=0
So perhaps these options are "hidden" in PHP 8.1 which is what SlickStack currently uses (the Ubuntu 22.04 default). He goes on to say the following:
In PHP 8.4, the default values for the two configuration options are changed as follows. JIT continues to be disabled by default in PHP 8.4. The only difference is that the default values for INI values have changed.
opcache.jit=disable opcache.jit_buffer_size=64M
Note that even with the default value changes, JIT is disabled by default.
Unless I made a mistake and forgot to includes those entries in our php.ini boilerplate for PHP 8.1, I think probably at this point we should wait until PHP 8.3 (Ubuntu 24.04) before we add those options to SlickStack.
Ref: https://medium.com/@edouard.courty/make-your-php-8-apps-twice-as-fast-opcache-jit-8d3542276595 Ref: https://stitcher.io/blog/php-8-jit-setup Ref: https://stackoverflow.com/questions/75609964/choosing-the-best-opcache-jit-buffer-size-value-in-php8-jit
Looks very exciting though...
https://slickstack.io/forum/topic/how-to-enable-php-opcache-jit-cuz-opcache-jit-is-missing-in-php-ini
A bit messy, I guess we needed a new boilerplate for /etc/php/8.3/mods-available/opcache.ini
New: https://github.com/littlebizzy/slickstack/blob/master/modules/php-fpm/8.3/opcache-ini.txt
Hopefully we can combine more of the opcache settings from php.ini into opcache.ini to keep it cleaner, but need to make sure it causes no issues first.
For now, JIT should be supported with 2 new options in ss-config below:
OPCACHE_JIT_CRTO="1255"
OPCACHE_JIT_BUFFER_SIZE=""
As seen above, the buffer size is blank by default (the same as PHP core) which effectively disables JIT. To enable it simply choose a buffer size like 64M or 100M or larger if your server has a lot of RAM...
Testing and feedback desired, will close this for now, thanks!