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 9, 2020 in PHP by kartik
• 37,520 points
3,177 views

1 answer to this question.

0 votes

Hello @kartik,

go to this address :

/app/Providers/AppServiceProvider.php

and append this code to end of file ....

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

Hope it helps!!

Thank You!!

answered Nov 9, 2020 by Niroj
• 82,880 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,880 points
4,373 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,880 points
17,037 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,880 points
6,974 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,880 points
28,615 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,880 points
22,945 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,880 points
2,963 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,880 points
2,896 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,880 points
44,381 views
0 votes
1 answer

How to change public folder to public_html in laravel 5?

Hello, you can register the following code at Application ...READ MORE

answered Nov 6, 2020 in PHP by Niroj
• 82,880 points
566 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,880 points
2,164 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP