GithubHelp home page GithubHelp logo

Comments (9)

tsantos84 avatar tsantos84 commented on June 2, 2024 1

Anything allowing them to reproduce would likely interest them!

@dunglas , I've found the issue. The problem happens when we provide a nonexistent file to opcache.preload (and that was my case).

I've managed to reproduce the issue by using this repo and make a small change on it. The step 3 is the offender.

  1. Install a fresh Symfony app following the dunglas/symfony-docker instructions and run the app on dev environment
  2. Stop the app with docker compose down
  3. Change the file frankenphp/conf.d/app.prod.ini and provide a nonexistent file to opcache.preload (eg. /foo/bar.php)
  4. Rebuild the image to prod env: docker compose -f compose.yaml -f compose.prod.yaml build --no-cache
  5. Provide JWT keys on compose.prod.yaml
  6. Run the app for production: docker compose -f compose.yaml -f compose.prod.yaml up -d

After that you will see the following log on app's container:

{"level":"error","ts":1709164144.1067986,"msg":"PHP Fatal error:  Uncaught Error: Call to undefined function dirname() in /app/public/index.php:5\nStack trace:\n#0 {main}\n  thrown in /app/public/index.php on line 5","syslog_level":"err"}

from symfony-docker.

dunglas avatar dunglas commented on June 2, 2024 1

I think that official PHP is more appropriate.

from symfony-docker.

7-zete-7 avatar 7-zete-7 commented on June 2, 2024

@tsantos84 hello!

Can you show content of your public/index.php file?

from symfony-docker.

tsantos84 avatar tsantos84 commented on June 2, 2024

Sure.

<?php

use App\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

But, after debugging the problem I found that opcache is causing the error. I've just comment the opcache line on Dockerfile and the error stopped. I'm assuming that on production the absense of opcache wont impact on performance once the app is loaded in memory with Frankenphp worker mode, right?

from symfony-docker.

dunglas avatar dunglas commented on June 2, 2024

Yes, but having Opcache still has benefits (faster worker boot time etc), and that's a very weird issue. Are you able to provide a reproducer? That would be nice to report this issue to PHP.

from symfony-docker.

tsantos84 avatar tsantos84 commented on June 2, 2024

Sure, I will try to create a reproducer. Basically the same Dockerfile, it means based on dunglas/frankenphp:1-alpine, right?

from symfony-docker.

dunglas avatar dunglas commented on June 2, 2024

Anything allowing them to reproduce would likely interest them!

from symfony-docker.

dunglas avatar dunglas commented on June 2, 2024

Could you check if switching to Debian fixes the issue by the way? Moving to Debian is on the roadmap: #555

from symfony-docker.

tsantos84 avatar tsantos84 commented on June 2, 2024

Could you check if switching to Debian fixes the issue by the way? Moving to Debian is on the roadmap: #555

No, the weird behavior happens on Debian as well. I've tried to build an official PHP image, install opcache and provide a wrong filename for opcache.preload but the issue does not happen. 🫤

I don't know if the issue resides on Frankenphp + Opcache + wrong filename or just PHP + Opcache + wrong filename. In this case, I don't believe that dunglas/symfony-docker should fix the issue and this issue could be closed. I'll let you decide what to do with it, ok? (close it or keep it opened)

Let me know if I should open an issue directly on Frankenphp repository or official PHP.

from symfony-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.