Multiple virtual hosts with Apache in live development server, Laravel 9 PHP Fatal error: Uncaught RuntimeException: A facade root has not been set #47024
Unanswered
trxSuperAdmin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a dev server that is used by me and a fellow dev, I have set up similar scenarios on live development servers before. The following Apache set up has worked on other Laravel projects, though lower versions.
The set up:
Server version: Apache/2.4.57 (Ubuntu)
PHP 8.1.18 (cli)
Laravel 9.19
React 18
Inertia 0.8.1
vite v3.2.6
There are 3 working directories, dir1, dir2 and dir3. In the apache conf files the following virtual host conf is enabled, {ip} omits the real IP addresses.
Apache virtual hosts file:
The working directory (dir1), serves and presents the application fine, dir2 and dir3 both through the same apache log error
[Wed May 10 15:06:12.166000 2023] [php:error] [pid 45741] [client {ip}:53093] PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /var/www/dir2/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:335\nStack trace:\n#0 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php(18): Illuminate\\Support\\Facades\\Facade::__callStatic()\n#1 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(642): Illuminate\\Foundation\\Exceptions\\RegisterErrorViewPaths->__invoke()\n#2 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(623): Illuminate\\Foundation\\Exceptions\\Handler->registerErrorViewPaths()\n#3 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()\n#4 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()\n#5 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()\n#6 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(493): Illuminate\\Foundation\\Exceptions\\Handler->render()\n#7 /var/www/dir2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(138): Illuminate\\Foundation\\Http\\Kernel->renderException()\n#8 /var/www/dir2/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle()\n#9 {main}\n thrown in /var/www/dir2/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 335
I have ran every cache clear command known to me, including the all singing all dancing php artisan optimize:clear
I've ran composer:update, npm run build, all to continue to get the same error each time.
I have ran this exact same Virtual host set up before in other Laravel 8 projects with even more ports and directories and have copied the exact same structure so the issue lies with the framework itself, however, I can't narrow down the root cause as to why the application will not run on multiple ports
Beta Was this translation helpful? Give feedback.
All reactions