Blade is not rendering the views, which are displayed as raw php. #52382
Replies: 20 comments 74 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.
-
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.
-
Just had the exact same issue and searched for hours. |
Beta Was this translation helpful? Give feedback.
-
I'm also having this issue with php8.3 in a fresh Laravel project. |
Beta Was this translation helpful? Give feedback.
-
My investigation on thisSo I have experienced this issue a couple of times now, and again today. Without us actively doing anything on the server, but possibly automatic minor patches are performed, i'm not certain. I've debugged the issue quite a bit, and figured somethings out. I've focused my attention mainly on
Summary / Short-term solution?We've figured out that simply restarting the php-fpm service resolves this issue, and it doesn't seem to come back quickly, we've had it come back maybe once or twice a year on just the one project. This also explains why some of you can't reproduce the issue after having fiddled a bit with your php service, likely you've restarted it at somepoint, fixing the incorrect constant values. Sadly because the issue is on a used application I couldn't continue my investigation for too long and had to opt to resolve it by the above method with no means to further reproduce the issue. If anybody finds the actual root cause behind this constant suddenly working incorrectly i'd love to hear it! |
Beta Was this translation helpful? Give feedback.
-
V8 vs V11 but prepareStringsForCompilationUsing function is never called from the framework so this is a dead end. There are a few other changes between these 2 versions and taking into account that the issue appears only in v11 might be a good starting place. |
Beta Was this translation helpful? Give feedback.
-
Update from our devops team:
For non Docker environment, if the PHP-FPM service isn’t restarted after an update, lingering old processes (from 8.3.8) could still be running, even though the new binary (8.3.9) is installed. This could explain unexpected behavior, especially if certain values or behaviors change between minor versions. |
Beta Was this translation helpful? Give feedback.
-
Another idea. |
Beta Was this translation helpful? Give feedback.
-
Issue created php/php-src#18067 on php. |
Beta Was this translation helpful? Give feedback.
-
Getting this error on PHP 8.3.20, Laravel 11, using Apache PHP, not PHP-FPM. I am not even using Blade for this request!
Nothing seems to fix this issue. Edit:
didn't change anything for the first time. Running it again helped to clear the error/bug. |
Beta Was this translation helpful? Give feedback.
-
On Runcloud, as it was an emergency but i could upgrade to 8.4 and the problem seemed to be gone after i run
With 8.3 I couldn't solve the issue |
Beta Was this translation helpful? Give feedback.
-
Hello, Today this problem happened to me. I use the RunCloud service here. I noticed that if I downgraded to PHP 8.2, the application started working again. Then I found out that yesterday (2025-05-26) the RunCloud platform released an update for PHP (PHP 8.3.21), but when I ran the command on the cli: php -v ... Linux continues to display version 8.3.20 I contacted the RunCloud team and they sent me a link to manually update their client (https://runcloud.io/docs/how-to-update-runcloud-agent-manually) After running this agent update, when I returned to Linux, the php -v command returned version 8.3.21 So I ran a php artisan view:clear and the problem was solved! @soipo please check my answer. |
Beta Was this translation helpful? Give feedback.
-
We are also using RunCloud service. We had 2 Laravel sites have this issue yesterday/today. I was able to fix by:
Another fix I've noticed is:
It's difficult to say exactly what causes it but the timing seems to coincide with the RunCloud's PHP minor upgrades run by the RunCloud agent. With that said, it completes these regularly and doesn't cause issues most of the time, and it doesn't cause this issue on all Laravel sites I manage using RunCloud either. Very strange. I can now fix the error by disabling OPcache and upgrading to PHP 8.4 (doesn't fix alone, need to clear all Laravel caches - most likely the cached views but haven't tried one by one specifically). I have reported to RunCloud and they are investigating their side so it'll be interesting to hear their report. Hope this helps someone. If anyone works out the root cause of this, please post in this thread. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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