Mouth
Well-known member
PHP 7.4+ provides a php script preloading function with the opcache.preload directive.
It requires a file, preload.php is commonly used, to provide a list of the php files to preload.
From https://www.php.net/manual/en/opcache.preloading.php ...
"PHP can be configured to preload scripts into the opcache when the engine starts [...] and load code into persistent memory"
... thus XF php code will remain in memory, instead of having to be processed and loaded each time it's called. Much faster and efficient.
I'd like to see XF provide a preload.php within installation files, listing all the appropriate files in the src/ tree that would benefit with preloading. Admin's wanting to utilise this functionality, can reference the preload.php in their PHP configuration if they desire.
Further from https://www.php.net/manual/en/opcache.preloading.php ...
"It also requires restarting the PHP process to clear pre-loaded scripts"
XF should check for opcache.preload being active when running upgrades and installs (web or cli), outputting a reminder for the admin to restart php.
It requires a file, preload.php is commonly used, to provide a list of the php files to preload.
From https://www.php.net/manual/en/opcache.preloading.php ...
"PHP can be configured to preload scripts into the opcache when the engine starts [...] and load code into persistent memory"
... thus XF php code will remain in memory, instead of having to be processed and loaded each time it's called. Much faster and efficient.
I'd like to see XF provide a preload.php within installation files, listing all the appropriate files in the src/ tree that would benefit with preloading. Admin's wanting to utilise this functionality, can reference the preload.php in their PHP configuration if they desire.
Further from https://www.php.net/manual/en/opcache.preloading.php ...
"It also requires restarting the PHP process to clear pre-loaded scripts"
XF should check for opcache.preload being active when running upgrades and installs (web or cli), outputting a reminder for the admin to restart php.
Upvote
1