Blade is not rendering the views, which are displayed as raw php. #52382
Replies: 9 comments 5 replies
-
After many hours of testing and after seeing that a fresh installation of Laravel 11 also failed, I modified the container, based on Alpine 3.20 and PHP 8.3, to use version 8.2, and it started working again. Something changed this morning in Alpine's PHP 8.3 libraries, particularly FPM, which completely broke the application and seems to be causing these issues. Since it does not seem to be related to the framework, I kindly ask you to CLOSE THE ISSUE and accept my apologies. As soon as things here return to normal, I will try to gather more information (if possible) in case it is of interest. Even so, if anyone is curious and requests more information, I will try to provide it. Thank you all, |
Beta Was this translation helpful? Give feedback.
-
If this happens again, upon updating PHP's version, try running these commands: composer dump-autoload
php artisan optimize:clear |
Beta Was this translation helpful? Give feedback.
-
Hi @rodrigopedra, Thanks for the reply. I tried everything, also clearing all caches but it finally seems to be a problem in the alpine FPM package for PHP 8.3, at least with the configuration I use. I am preparing a docker image to reproduce the error and pass the issue to the package maintainer. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Wow, I created a couple of images (PHP 8.2 and 8.3) this weekend to try to reproduce the error with an empty Larevel 11 project, but I couldn't reproduced it. I will try PHP 8.3 with our application again to see if the issue with the package, I believe it's FPM, has disappeared as suddenly as it appeared. |
Beta Was this translation helpful? Give feedback.
-
I have the same problem, but my config are: php 8.3.8, npm 10.2.4, node 20.11.1 and composer 2.7.1 |
Beta Was this translation helpful? Give feedback.
-
Maybe the problem is with the OpCache. We have the same problem and disabling opcache seems to be working |
Beta Was this translation helpful? Give feedback.
-
@JesusRodriguezAcosta @luizboaretto Did you ever get to this bottom of this? I have the same issue which is intermittent on 6 different codebases. Not using Docker, or Alpine, just standard PHP 8.3 FPM. I've tried clearing OPCache and changing PHP Versions to 8.2 (as well as clearing everything in php artisan and composer) with no luck. Only thing that's worked for me was adding a random space to a view and redeploying. This makes me think it's still OPCache maybe. |
Beta Was this translation helpful? Give feedback.
-
I'm getting the same issue right now on a freshly installed Laravel 11.x, I believe it's an 11.x issue because 10.x works fine Blade directives such as @include, and @content are printed plain on the pages, and views are not processed. |
Beta Was this translation helpful? Give feedback.
-
My advice is to have a base image with all dependencies installed so all you have to do is add your code to it when you build the final image.thst way you have always the same versions. See it as a form of package.lock/composer.lock. |
Beta Was this translation helpful? Give feedback.
-
Laravel Version
11.x
PHP Version
8.3.9
Database Driver & Version
No response
Description
A few days ago, we updated Laravel and PHP to the latest available versions. Everything went great until this morning when the views stopped working in our last build. Since then, we were not able to put it working again.
Apparently, Blade is not "processing" the views, which are displayed in as raw php.
So, what you see in the HTML is like:
I have no idea why it was working yesterday and not today. I expent several but nothing worked. I also found out that if I compile the views, some of them are displayed, but the error pages produce another error. It’s really strange.
Upon inspecting the cached views at runtime within "storage," it is clear that Blade directives are indeed not being processed. However, if I run php artisan view:cache, they are processed correctly.
I also downgrade to 10, but still the same issue with blade.
EDITED; I tried with a clean installation of Laravel 11 and still getting the same problem, so it looks something related with the container (alpine 3.20 with some extensions).
The error shown:
Undefined variable $component (View: /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/resources/exceptions/renderer/show.blade.php)
@component('Illuminate\View\AnonymousComponent', 'laravel-exceptions-renderer::layout', ['view' => 'laravel-exceptions-renderer::components.layout','data' => ['exception' => $exception]])<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?><?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?><?php endif; ?><?php $component->withAttributes(['exception' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($exception)]); ?> <div class="renderer container mx-auto lg:px-8">@component('Illuminate\View\AnonymousComponent', 'laravel-exceptions-renderer::navigation', ['view' => 'laravel-exceptions-renderer::components.navigation','data' => ['exception' => $exception]])<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?><?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?><?php endif; ?>
I've tried with Alpine Edge and PHP 8.3.10 and the same error occurs. Does anyone have any idea what might be happening?
Steps To Reproduce
No idea.
Beta Was this translation helpful? Give feedback.
All reactions