You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
If you enable in php.ini configuration preloading for prod environment, opcache.preload=/app/var/cache/prod/App_Infrastructure_KernelProdContainer.preload.php opcache.preload_user=www-data
you will see the next error during composer update command:
Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Terminal' not found in /app/vendor/symfony/console/Application.php:84
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(101): Symfony\Component\Console\Application->__construct('Composer', '1.10.7')
#1 phar:///usr/local/bin/composer/bin/composer(60): Composer\Console\Application->__construct()
#2 /usr/local/bin/composer(24): require('phar:///usr/loc...')
#3 {main}
thrown in /app/vendor/symfony/console/Application.php on line 84
This error not reproduced for other environments.
If you will add Class 'Symfony\Component\Console\Terminal' to ...preload.php file, you will see another error.
I guess something wrong with ...preload.php file.
How to reproduce
I created simple project that contain only symfony code, with instruction how to reproduce it https://github.com/Nidhognit/symfony-error-example
You need to have docker-compose for it.
Additional context
Probably, this is composer error, but it happen only with symfony preload file and only for prod environment
The text was updated successfully, but these errors were encountered:
Hi, thanks for the nice reproducer.
The reason is that composer is not compatible with recent versions of symfony/console and when preloading is used, the Application.php that is loaded is too recent for it.
The solution is either to set opcache.enable_cli=0, or to enable preloading only for php-fpm.
TL;DR: preloading is useless and conflicts with using PHP on the CLI.
Nothing we can do about here, that's one of its requirements.
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] disable preload.php on the CLI
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37152
| License | MIT
| Doc PR | -
See linked issue for a nasty side-effect of preloading on the CLI. Many hosting solutions do not provide a way to set different ini settings for CLI vs FPM. Let's skip preloading anything on the CLI.
Commits
-------
50ccf2f [DI] disable preload.php on the CLI
Symfony version(s) affected: 5.0.*
php: 7.4.*
Description
If you enable in php.ini configuration preloading for prod environment,
opcache.preload=/app/var/cache/prod/App_Infrastructure_KernelProdContainer.preload.php opcache.preload_user=www-data
you will see the next error during
composer update
command:This error not reproduced for other environments.
If you will add Class 'Symfony\Component\Console\Terminal' to ...preload.php file, you will see another error.
I guess something wrong with ...preload.php file.
How to reproduce
I created simple project that contain only symfony code, with instruction how to reproduce it https://github.com/Nidhognit/symfony-error-example
You need to have docker-compose for it.
Additional context
Probably, this is composer error, but it happen only with symfony preload file and only for prod environment
The text was updated successfully, but these errors were encountered: