Website Can't Access My Folders (Laravel)

Website URL

http://littlesmartdaycare.infinityfreeapp.com/
This is my landing page.

Error Message

Currently, the server indicates unable to locate my blade view files. However, in my local environment with the same settings, the server can run normally, I don’t understand what went wrong here.

ChatGPT suggestion: Hosting Issues: If the issue persists after verifying these details, consider contacting InfinityFree support. There may be server-specific configurations or limitations that are affecting your file access.


As of posting, the error message should be:

InvalidArgumentException View [index] not found.

Other Information

I double checked filemanager.ai that my blade view, index.blade.php, is present. I’ll share my code snippets here for direct reference, hope it helps.

PostController.php

<?php

namespace App\Http\Controllers;

use App\Models\Post;

class PostController extends Controller
{
    /**
     * (CRUD read)
     * Display a listing of the resource, exclusive for announcement page.
     *
     * Retrieves all records from 'posts' table, split into several pages,
     * Decode JSON data for 'posts.images', which converts JSON string to
     * PHP array. Pass final data to blade view.
     */
    public function indexHome()
    {
        // Cut-off point for page nav btn is 15 pages (ellipsis will appear)
        $posts = Post::orderBy('createdtime', 'desc')->paginate(5); // number of records per page

        $posts->getCollection()->transform(function ($post) {
            $post->images = json_decode($post->images);
            return $post;
        });

        // pass an empty variable
        // $posts = collect();

        return view('index', compact('posts'));
    }
}

web.php

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PostController;
use App\Http\Middleware\CheckSessionTimeout;

// Session timeout check wrapper
Route::middleware([CheckSessionTimeout::class])->group(function () {

    // true landing page
    Route::get('/', [PostController::class, 'indexHome']
    )->name('index');
});

I briefly reviewed similar topics, most of them ended unfinished, or at least unable to resolve my current issue. I manually cached my website and updated the host files, my
.env

APP_URL=local

is due to my
AppServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // Convert HTTP to HTTPS when
        // [.env] file [APP_ENV] variable = "production"
        if ($this->app->environment('production')) {
            URL::forceScheme('https');
        }
    }
}

automatically redirect to https format, which is still under testing, thus I the env is set to local to adhere to http format at the meantime.

These are all the relevant info I can think of, please let me know how can I assist in pointing out the root cause. Thank you.

I opened a 2nd post to reflect my new observations, as well as my solution discovered by chance.

Other Information (Update)

My /public directory has 2 unusual fullpath-named folders as shown here:

Those files should be updated at my root folder /storage, if possible I want to identify this issues whether stems from my end or not.

These are all the relevant info I can think of, please let me know how can I assist in pointing out the root cause. (I am unable to edit my previous post) Thank you.

I finally traced the issue from the new observation.

Source issue: /htdocs/bootstrap/cache/config.php

Even though I manually cached & updated my files, this particular file doesn’t update for the most part, for the code block in question here:

'view' => 
  array (
    'paths' => 
      array (
        0 => 'C:\\laravel_little_smart_website\\resources\\views',
      ),
    'compiled' => 'C:\\laravel_little_smart_website\\storage\\framework\\views',
  ),

They are all pointing to my local setup, so after I change it to point to host folder:

'view' => 
  array (
    'paths' => 
      array (
        0 => '/home/vol14_2/infinityfree.com/if0_37135633/htdocs/resources/views',
      ),
    'compiled' => '/home/vol14_2/infinityfree.com/if0_37135633/htdocs/storage/framework/views',
  ),

It finally works. If anyone was cheering me on, thanks XD

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.