Mic0 Mic0 - 4 months ago 35
PHP Question

how to change public folder to public_html in laravel 5

I'm using a shared hosting which uses cpanel as its control panel and within the cpanel public_html is the default root directory, because of this I can't get my laravel application work properly. Is there any way to make laravel use public_html instead of public folder?

Answer

Quite easy to find this with a simple search.

See: https://laracasts.com/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5

In your index.php add the following 3 lines.

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

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

// set the public path to this directory
$app->bind('path.public', function() {
    return __DIR__;
});
Comments