I'm attempting to make use of the new preloading feature available since PHP 7.4.
I ran composer install --no-dev --optimize-autoloader
to generate a list of all available classes in the project, and used the following preload.php
script to preload them:
$files = require 'vendor/composer/autoload_classmap.php';
foreach (array_unique($files) as $file) {
opcache_compile_file($file);
}
And configured this preload script in my opcache.ini
file:
opcache.preload=/path/to/preload.php
And restarted php-fpm
. Now systemctl status php-fpm.service
reports the following warnings:
PHP Warning: Can't preload unlinked class Brick\Money\Context\CashContext: Unknown type dependencies in ... on line 16
PHP Warning: Can't preload unlinked class Brick\Money\Context\AutoContext: Unknown type dependencies in ... on line 17
PHP Warning: Can't preload unlinked class Brick\Math\BigRational: Unknown type dependencies in ... on line 17
PHP Warning: Can't preload unlinked class Brick\Math\BigInteger: Unknown type dependencies in ... on line 20
PHP Warning: Can't preload unlinked class Brick\Math\BigDecimal: Unknown type dependencies in ... on line 15
What does "Unknown type dependencies" mean? How can I get these classes preloaded?
Note: I'm the maintainer of the offending libraries Brick\Math and Brick\Money, so if these are in need of modifications to make them preloadable, I'm all ears!