Search code examples
phpapachelaravelhttp-status-code-500

Getting 500 error when loading view when deployed on server


So I have a Laravel 5.2 project, which is deployed as a local virtualhost and on remote server.

And I'm getting 500 error when I call for a particular view, when it's on remote, locally everything works fine.

The problem is, that everything seems to be okay with view, controller and routes.

The route looks as follows:

Route::get('/mp', 'MpController@index');

Controller method is just getting arrays from models and then returning the view with these arrays, like this:

public function index()
    {
        $clients = User::where('role','client')->get()->toJson();
        $agencies = User::where('role','agency')->get()->toJson();
        return View('admin.mp.index', compact('clients','agencies'));
    }

I've tried making controller return only arrays, without view, and it's working fine, so the problem is not with models.

And here is the strangest part: from the beginning, I had a view called demo.blade.php, and this view was called in index method of my controller. But then, I created a view called index.blade.php and copied the contents of demo there, so these two files are completely identical and stored in one folder. But when I call demo from my controller, everything works just fine, but if I change 'demo' to 'index', I get 500 error, even if index is completely empty or contains just text or whatever.

And as I said already, locally everything works fine, but on the remote server I get this kind of error on all new added views. I've tried making dump-autoload, I've checked if those files are uploaded for like thousand times, I turned on logging and displaying errors in apache logs, but I still get nothing about this issue.

What could be the problem and how could I solve it? Would highly appreciate any possible help!


Solution

  • Okay, the error was in permissions, I updated chmod on my project folder, and everything started to work fine