Comments (9)
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.
- Install a fresh Symfony app following the
dunglas/symfony-docker
instructions and run the app on dev environment - Stop the app with
docker compose down
- Change the file
frankenphp/conf.d/app.prod.ini
and provide a nonexistent file toopcache.preload
(eg. /foo/bar.php) - Rebuild the image to prod env:
docker compose -f compose.yaml -f compose.prod.yaml build --no-cache
- Provide JWT keys on
compose.prod.yaml
- 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.
I think that official PHP is more appropriate.
from symfony-docker.
@tsantos84 hello!
Can you show content of your public/index.php
file?
from symfony-docker.
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.
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.
Sure, I will try to create a reproducer. Basically the same Dockerfile, it means based on dunglas/frankenphp:1-alpine
, right?
from symfony-docker.
Anything allowing them to reproduce would likely interest them!
from symfony-docker.
Could you check if switching to Debian fixes the issue by the way? Moving to Debian is on the roadmap: #555
from symfony-docker.
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)
- Should var/ be a volume in production container based on compose or Dockerfile HOT 1
- Access app with my local network ip HOT 4
- Using custom TLS certificates does not work HOT 2
- Could not connect to /var/run/php/php-fpm.sock at build time HOT 8
- Installing on existing projects without local php / composer HOT 2
- Problem with "docker-entrypoint" under Windows HOT 11
- Service 'php' failed to build : Build failed HOT 1
- How to run multiple projects HOT 4
- Run as a different user HOT 7
- cdn.jsdelivr.net importmap:install ERROR Curl HOT 4
- invalid interpolation format for services.php.environment.TRUSTED_HOSTS HOT 1
- Too stupid for recipes HOT 4
- Is mecure required for production? HOT 1
- Unable to connect to external database HOT 1
- Could this repo be converted to a symfony recipe? HOT 1
- Unable to boot app in production mode HOT 2
- Large number of entities cause ORM mapping to break HOT 5
- .env.prod.local not picked up on docker compose up HOT 4
- Unable to deploy in production HOT 3
- invalid interpolation format for services.php.environment.TRUSTED_HOSTS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfony-docker.