skip to Main Content

I am trying to deply laravel app (Laravel 5.4.36), and I uploaded content of the public directory to public_html, and other folders are uploaded in root footer of my hosting username.

Index.php paths are modified to load bootstrap/autoload.php and bootstrap/app.php based on new paths, and I ensured that the index.php has permission to access those files.

The problem is that I get this message when I try to access index.php

  Fatal error: Uncaught Error: Call to a member function make() on string in /home/myuser/public_html/index.php:54 Stack trace: #0 {main} thrown in /home/myuser/public_html/index.php on line 54

and the line referred here is

$kernel = $app->make(IlluminateContractsHttpKernel::class);

I also tried with several php versions, 7.1, 7.2 and 7.3.
I use Apache and Cpanel on shared server, but I also have root access to this server so I can reconfigure what is needed.

I followed this tutorial https://www.youtube.com/watch?v=6g8G3YQtQt4

2

Answers


  1. Chosen as BEST ANSWER

    I found the problem

    The $app was string, I somehow changed it into string so instead

    $app =  require_once __DIR__.'/../bel/bootstrap/app.php';
    

    it was

    $app =  __DIR__.'/../bel/bootstrap/app.php';
    

  2. You follow these steps to solve your issue

    1. create a new folder for your laravel project.

    2. then upload everything in it including public folder without changing paths

    3. follow the following steps to change your root folder to /public

    https://tecadmin.net/how-to-change-document-root-of-primary-domain-in-cpanel/

    For changing the main/primary domain, you will need to have root SSH access and be able to locate and edit the following file (replacing your user & domain info):

    /var/cpanel/userdata/USERNAME/DOMAIN.COM
    1. Once you have opened the file, look for the following line:

    documentroot: /home/USERNAME/public_html
    2. Modify the location according to your needs. Save it and exit.

    1. Rebuild the Apache conf and restart Apache:

    /scripts/rebuildhttpdconf
    service httpd restart
    The change will be immediate. Simply clear your browser cache and force refresh the page!

    or you have another option to just upload your laravel folder beside public_html and all files in laravel public folder in public_html without changing paths

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search