Search code examples
phplaravel-5shared-hosting

Laravel 5 on shared hosting - wrong public_path()


I deployed a Laravel 5 project to a shared hosting account, placing the app-files outside of the www-folder, placing only the public folder inside of the www-folder. All like explained here, in the best answer: Laravel 4 and the way to deploy app using FTP... without 3. because this file doesn't exist in Laravel 5.

Now when I call public_path() inside of a controller i get something like my-appfiles-outside-of-www/public instead of www/public. Does anyone know why I doesn't get the right path here? Can I change this somewhere? Thanks!


Solution

  • You can override public_path using container. Example:

    App::bind('path.public', function() {
        return base_path().'/public_html';
    });