How to change public folder to public html in laravel 5

0 votes
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?
Nov 6, 2020 in PHP by kartik
• 37,490 points
58 views

1 answer to this question.

0 votes

Hello,

you can register the following code at Application Service Provider (App\Providers\AppServiceProvider.php).

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

public function register()
{
    $this->app->bind('path.public', function() {
        return base_path().'/public_http';
    });
}

Hope it works!!

Thank You!!

answered Nov 6, 2020 by Niroj
• 82,560 points

Related Questions In PHP

0 votes
1 answer

How to change the session timeout in PHP?

Hello @kartik, Put $_SESSION['login_time'] = time(); into the previous authentication ...READ MORE

answered Sep 15, 2020 in PHP by Niroj
• 82,560 points
396 views
0 votes
1 answer

How to get base url in laravel using php?

Hello @kartik, You can use the URL facade ...READ MORE

answered Sep 17, 2020 in PHP by Niroj
• 82,560 points
2,699 views
0 votes
1 answer

How to truncate string in Laravel blade templates?

Hello @kartik, In Laravel 4 & 5 (up ...READ MORE

answered Oct 6, 2020 in PHP by Niroj
• 82,560 points
1,047 views
0 votes
1 answer

How to include External CSS and JS file in Laravel?

Hello @kartik, The right way is this one: <script ...READ MORE

answered Oct 27, 2020 in PHP by Niroj
• 82,560 points
3,179 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,560 points
5,537 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,560 points
641 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,560 points
490 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,560 points
6,125 views
0 votes
1 answer

How to change public folder to public_html in laravel 5?

Hello @kartik, go to this address : /app/Providers/AppServiceProvider.php and append ...READ MORE

answered Nov 9, 2020 in PHP by Niroj
• 82,560 points
451 views
0 votes
1 answer

How to disable registration new users in Laravel?

Hello @kartik, Laravel 5.7 introduced the following functionality: Auth::routes(['register' ...READ MORE

answered Aug 24, 2020 in PHP by Niroj
• 82,560 points
406 views