Skip to main content

Comments

9 comments

  • Larry

    Most of that is covered in our PHP Tuning guide, here:

    https://docs.platform.sh/languages/php/tuning.html#configure-opcache

    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:

    variables:
        php: 
            'opcache.validate_timestamps': 0
    

    The PHP-FPM server is restarted when you update code anyway. The default composer command we use already optimizes the autoloader.

    Cheers.

    0
  • Quentin Thiaucourt

    Thanks! Really helpful :slight_smile:

    0
  • Quentin Thiaucourt

    I setup things like that, but I find myself having to redeploy, because deployments seems to be using the previous file versions :confused:

    Any idea what could be causing this?

    0
  • Quentin Thiaucourt

    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?
    Thanks!

    0
  • Larry

    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.)

    0
  • Quentin Thiaucourt

    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?

    0
  • Larry

    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?

    0
  • Quentin Thiaucourt

    My app is a typical Symfony one. I didn’t do anything special with how the templates are used/compiled.

    I run cache:clear at build and deploy, just like in your template.

    0
  • Renaud Grand

    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?

    0

Please sign in to leave a comment.