How to run Laravel 5.x on shared hosting?
Khanh is a full stack web developer with over 15 years of experience developing for the web
Search for a command to run...
Khanh is a full stack web developer with over 15 years of experience developing for the web
No comments yet. Be the first to comment.
Elevate your bus reservation experience (or even movie, theater, train, ship, plane tickets) with the React Bus Seat Map Picker – a sophisticated and meticulously crafted script designed exclusively for bus seat bookings. Engineered with strict TypeS...

In previous blog, I migrated all posts from my WordPress to Hashnode at https://blog.donamkhanh.com. Now I create a simple landing page for my main domain and hosted on Github Page. You can access at https://donamkhanh.com. In feature, I'm going to h...

I just finished migrating my blog from Wordpress (self hosted on DigitalOcean) to Hashnode. How did I migrate? I don't have too many articles on Wordpress but I don't like doing it manually so the first thing I did was look to see if there was an aut...

Dự án mình đang làm có yêu cầu sử dụng Azure Active Directory (AAD) để lưu trữ thông tin người dùng & xác thực đăng nhập các kiểu. Ngoài các trường thông tin cơ bản mà AAD hỗ trợ ra thì dự án mình cần lưu thêm 1 số thông tùy chọn khác cho người dùng....

Introduction This is a concise front-end application developed with Angular. You can create a beautiful form with drag and drop visualization. You can get inspiration from it to make a draggable form; at the same time, you can also modify it to suit ...

It is very easy to run Laravel on VPS or dedicated hosting but how about on shared hosting?
On VPS, you just need to create a virtual host and point the root directory into Laravel public folder.
But on shared hosting, they usually have public_html folder instead of public folder. You can create public folder but how to point document root to public instead of public_html folder? Yup, usually not :(
Fortunately, Laravel allow us run under whatever folder we want, just update some lines of code :) First, rename public folder to public_html, edit index.php by adding this block after $app require_once statement:
// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
});
Second, add the below code in register() method at app/Providers/AppServiceProvider.php file:
$this->app->bind('path.public', function() {
return base_path('public_html');
});
Tada! Now you can run your Laravel application smoothly!