Infinity host cant find index.php of laravel project

Website URL

docuvault.great-site.net

Error Message**
403 Forbidden**

Server or website configuration is blocking you from viewing this page

Other Information

**
the .htaccess added in htdocs (chatgpt suggestion)**

php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone America/New_York

RewriteEngine On
# Only rewrite if the request is not already for public/ or an existing file/folder
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect everything else into public/
RewriteRule ^(.*)$ public/$1 [L]

if gone to https://docuvault.great-site.net/public/index.php

Fatal error: Uncaught ReflectionException: Class “view” does not exist in /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php:1122 Stack trace: #0 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(1122): ReflectionClass->__construct(‘view’) #1 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(933): Illuminate\Container\Container->build(‘view’) #2 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\Container\Container->resolve(‘view’, Array, true) #3 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(864): Illuminate\Foundation\Application->resolve(‘view’, Array) #4 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\Container\Container->make(‘view’, Array) #5 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(1809): Illuminate\Foundation\Application->make(‘view’) #6 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(177): Illuminate\Container\Container->offsetGet(‘Illuminate\\Cont…’) #7 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(1115): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array) #8 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(933): Illuminate\Container\Container->build(Object(Closure)) #9 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\Container\Container->resolve(‘Illuminate\\Cont…’, Array, true) #10 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(864): Illuminate\Foundation\Application->resolve(‘Illuminate\\Cont…’, Array) #11 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\Container\Container->make(‘Illuminate\\Cont…’, Array) #12 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(138): Illuminate\Foundation\Application->make(‘Illuminate\\Cont…’, Array) #13 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(851): app(‘Illuminate\\Cont…’) #14 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(987): response(‘<!-- Class &quo…’, 500, Array) #15 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(839): Illuminate\Foundation\Exceptions\Handler->toIlluminateResponse(Object(Symfony\Component\HttpFoundation\Response), Object(Error)) #16 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(738): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Error)) #17 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse(Object(Illuminate\Http\Request), Object(Error)) #18 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(574): Illuminate\Foundation\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Error)) #19 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(148): Illuminate\Foundation\Http\Kernel->renderException(Object(Illuminate\Http\Request), Object(Error)) #20 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1220): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #21 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/public/index.php(21): Illuminate\Foundation\Application->handleRequest(Object(Illuminate\Http\Request)) #22 {main} Next Illuminate\Contracts\Container\BindingResolutionException: Target class [view] does not exist. in /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php:1124 Stack trace: #0 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(933): Illuminate\Container\Container->build(‘view’) #1 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\Container\Container->resolve(‘view’, Array, true) #2 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(864): Illuminate\Foundation\Application->resolve(‘view’, Array) #3 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\Container\Container->make(‘view’, Array) #4 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(1809): Illuminate\Foundation\Application->make(‘view’) #5 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(177): Illuminate\Container\Container->offsetGet(‘Illuminate\\Cont…’) #6 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(1115): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array) #7 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(933): Illuminate\Container\Container->build(Object(Closure)) #8 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1078): Illuminate\Container\Container->resolve(‘Illuminate\\Cont…’, Array, true) #9 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(864): Illuminate\Foundation\Application->resolve(‘Illuminate\\Cont…’, Array) #10 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1058): Illuminate\Container\Container->make(‘Illuminate\\Cont…’, Array) #11 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(138): Illuminate\Foundation\Application->make(‘Illuminate\\Cont…’, Array) #12 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(851): app(‘Illuminate\\Cont…’) #13 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(987): response(‘<!-- Class &quo…’, 500, Array) #14 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(839): Illuminate\Foundation\Exceptions\Handler->toIlluminateResponse(Object(Symfony\Component\HttpFoundation\Response), Object(Error)) #15 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(738): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Error)) #16 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse(Object(Illuminate\Http\Request), Object(Error)) #17 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(574): Illuminate\Foundation\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Error)) #18 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(148): Illuminate\Foundation\Http\Kernel->renderException(Object(Illuminate\Http\Request), Object(Error)) #19 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1220): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #20 /home/vol12_7/infinityfree.com/if0_40750518/htdocs/public/index.php(21): Illuminate\Foundation\Application->handleRequest(Object(Illuminate\Http\Request)) #21 {main} thrown in /home/vol12_7/infinityfree.com/if0_40750518/htdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1124

This is expected. So read on

5 Likes

I assume you are using Laravel 12, then you can do the following:

Step 1: Upload files inside the public (local) folder to the htdocs (hosting) folder.

Step 2: In the htdocs (hosting) folder, create a new folder with the name you want. In this example, I will use the name my_source.

Step 3: Go to the my_source folder, and upload all the remaining folders it has in your Laravel project.

Note:

  • No need to upload public (local) folder and its files anymore.

  • It is mandatory to upload the entire vendor (local) folder. It has ~9000 files inside the vendor (local) folder, so this step might take a while.

Step 4: After all, go back to the htdocs (hosting) folder, open the index.php file and edit the following paths:

<?php

use Illuminate\Foundation\Application;

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// Determine if the application is in maintenance mode...

if (file_exists($maintenance = __DIR__.'/my_source/storage/framework/maintenance.php')) { // Replace it with the folder name you set before, instead of `my_source`!

require $maintenance;

}

// Register the Composer autoloader...

require __DIR__.'/my_source/vendor/autoload.php'; // Replace it with the folder name you set before, instead of `my_source`!

// Bootstrap Laravel and handle the request...

/** @var Application $app */

$app = require_once __DIR__.'/my_source/bootstrap/app.php'; // Replace it with the folder name you set before, instead of `my_source`!

$app->handleRequest(Request::capture());

Step 5: Finally, try accessing your website again (https://docuvault.great-site.net) and check if it works.

Good luck!

There are a few different ways to make Laravel work on our hosting, i.e. work around the limitation of not being able to change the document root of your website.

My personal preference is to leave the Laravel installation as-is, and instead use .htaccess rules to reroute the website base directory to the public directory like so:

This is not the only method, but this is the method I recommend. I have no idea if that approach from ChatGPT works.

That said, usually what people want is to get rid of the public part in the URL, which at least your current code clearly doesn’t seem to be doing.

This error suggests a different issue entirely. Specifically, this implies that the ViewServiceProvider is missing, which is not a .htaccess issue.

This is strange though because Laravel should do this out of the box. So I’m not sure why this is happening, other than that it’s probably an issue with how your site is set up.

6 Likes