I’m working on a Symfony app and was reviewing the performance recommendation here: https://symfony.com/doc/current/performance.html#don-t-check-php-files-timestamps
Do I have to do something special to ensure one of the 3 items is done? Or does the first one (Restart the web server) is done anyhow?
Thanks for your help
Most of that is covered in our PHP Tuning guide, here:
The opcache file check is on by default to support applications that generate code at runtime. You can turn it off yourself via
.platform.app.yaml like so:
The PHP-FPM server is restarted when you update code anyway. The default composer command we use already optimizes the autoloader.
I setup things like that, but I find myself having to redeploy, because deployments seems to be using the previous file versions
Any idea what could be causing this?
After investigating a bit, I found that sometimes Symfony templates are not updated correctly and still using their previous (probably cached) version.
Can you help me with that?
Could it be a case of not triggering a new build, just a deploy, and so you don’t get updated code? I assume by Symfony templates you mean compiled Twig templates.
(Sorry for the delay; Discourse’s notifications are not great.)
Yes: compiled Twig templates.
Could it be a case of not triggering a new build, just a deploy
Maybe. But what does pushing code to Platform.sh do? Isn’t it supposed to trigger a new build?
Yes, a code push that changes files in that application will trigger a new build; you can see in the console output if it’s building, and if there are any error messages along the way.
I’m 98.3% certain that a deploy after a build will always cause FPM to restart, which should clear the opcache. Without looking at your project specifically I’m not sure what the issue could be. All of your templates are being compiled at build time, not deploy time, yes?
My app is a typical Symfony one. I didn’t do anything special with how the templates are used/compiled.
cache:clear at build and deploy, just like in your template.
I think I’m having the same issue. The twig files files are being regenerated by
cache:clear in my deploy hook. I can see that in
var/cache/prod I have the correct version. But the files being served are still the old ones.
Same as @quentin-thiaucourt I use
cache:clear in both my hooks as per template.
After troubleshooting the issue with the support, commenting out:
# opcache.preload: /app/config/preload.php
Solved the issue. I guess it was called too early and generated the opcache based on the old files?