How to Install the PHP Framework Laravel on Shared Hosting
How to Install the PHP Framework Laravel on Shared Hosting
Updated on Oct 19, 2022
Various tools and frameworks are available to you when building a web application. However, many believe that Laravel is the best choice for building modern, full-stack web applications. With FastComet, you can install Laravel on your Shared Hosting account and use it as you wish. Laravel combines the best packages in the PHP ecosystem to offer a robust developer-friendly framework available. Furthermore, thousands of talented developers contribute to the framework continuously, which proves its quality.
This guide will go through the two primary methods to install Laravel on the FastComet shared hosting servers. Additionally, we will share the most crucial benefits that come with using the framework.
Table of Contents:
What is Laravel?
Laravel is a web application framework with expressive syntax. Laravel’s main goal is to provide an exceptional developer experience while also offering powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
Whether you are new to PHP or have years of experience, Laravel is a framework that can be a good starting point and help you grow.
How to Install Laravel on Shared Hosting
You have two basic options to install Laravel on shared hosting:
- Install Laravel via Softaculous Apps Installer (Beginner);
- Install Laravel via Composer through SSH (Advanced).
Even if the SSH option is a little different, it’s still not too difficult, as long as you follow our instructions.
- PHP >= 7.2.5.
Option 1: Install Laravel on Shared Hosting via Softaculous
Using Softaculous to install Laravel is a quick process. All you have to do is follow the steps below:
- Log into cPanel;
- Under Software, choose Softaculous Apps Installer:
- Under Frameworks, select Laravel:
- Click Install:
- Make sure to deselect the default directory selection “laravel” by erasing it if you want to install Laravel on your primary domain:
- Click Install.
Option 2: Install Laravel on Shared Hosting via Composer (SSH)
Laravel utilizes Composer to manage its dependencies. Before we start, we need to remind you that FastComet uses a custom SSH port - 17177. In that case, if you are using a Command Line (CLI) different from the Terminal* in your cPanel, your starting command should be:
ssh [email protected] -p 17177
Where ‘user’ is your FastComet username and ‘server.ip.address-or-remote-hostname’ is the IP address or the hostname of the server you are trying to connect to.
To use SSH Access on Shared Hosting, you need to first allow your IP address, as seen in our tutorial here.
*When you use the cPanel Terminal, you are already signed in and can start executing your SSH commands.
You will be asked for your password, and after you've successfully authenticated, you can continue with your Laravel installation via Composer:
If you wish to try the latest version of Laravel, keep in mind that it’s usually not included in Softaculous right away. Even if that’s the case, you can still install it manually on FastComet Shared Hosting via Composer.
You need to check and see if your chosen PHP version is compatible with the specific Laravel version you aim to install. For example, if you want to install Laravel 9, you would need PHP 8.0.2 or higher. If you need any help installing or figuring out what your PHP version is, you can check out our tutorial How to Change Default PHP Version in cPanel.
You can also find out the server’s PHP version in SSH with the following command:
Here are the steps to follow:
- Create a new Laravel project by directly using Composer:
composer create-project laravel/laravel example-app
- Go to the proper directory:
- Start Laravel’s local development server using the Artisan CLI’s serve command:
php artisan serve
The other option for you is to install the Laravel Installer as a global Composer dependency following the commands below:
composer global require laravel/installer
laravel new example-app
php artisan serve
Ensure that Composer’s system-wide vendor bin directory is placed in your
$PATH, so the
laravel executable can be located by your system.
Benefits of Laravel Framework
You may be wondering why you should use Laravel to build your website. In fact, there are various advantages that come with the framework. Let’s go over the major ones.
Laravel is Quick and Simple
Laravel is the number one PHP framework, which means most web developers are familiar with it. Being open source makes choosing it even better. While using the framework, you have a wide variety of built-in templates to choose from, all of which make development seamless. If you are on the road to becoming an expert Laravel developer (or you already have the expertise), you could even build a 5 or 6-page website in just two days. The faster the development time—the quicker the results for your business.
Laravel Offers a High Level of Security
Naturally, security is the number one concern for most businesses, as it should be. With Laravel, advanced security features are quick to configure on most websites to enhance security and protect sites from hackers and cybercriminals. To get a bit technical, Laravel uses a Bcrypt hashing algorithm which means it never saves any passwords in the database. Laravel also has great user authentication, and restricted access features are not difficult to create. This keeps you and your customer’s data safe and secure.
Laraver Leads to Optimal Website Performance
Laravel supports caching for your website out-of-the, which boosts your site speed. The framework makes other speed optimization techniques, such as memory use reduction and database indexing, really easy to implement to enhance your website's performance further. This makes Laravel an excellent choice for your business, considering that site speed and SEO friendliness are probably your primary goals.
Laravel is Great for Traffic-handling
As your business grows, so will the traffic volume to your site. A website built in Laravel can handle website requests quicker than most other frameworks. Laravel uses a unique message queue system, meaning you are able to put off certain website tasks such as sending emails until a later time. Being able to control time-consuming tasks helps your website process tasks as fast as possible. This not only keeps your website’s server healthy, but can also lower your hosting costs in the long term. At FastComet, we do everything to make sure you get the best web hosting experience for the optimal price.
Laravel is Flexible
Laravel has the needed power to build a fully-fledged eCommerce site or a professional and straightforward B2B site. Due to its extensive pre-installed authorization libraries, the framework has the ability to create and support various advanced features for your website, such as password reset and encryption. Additionally, there are tons of third-party packages available to give your website a range of features and functionalities. One example is Socialite, which enables users to sign into your site using their social media profiles if you decide to integrate that option.
Laravel is a Master of Third-party Integrations
Most websites need to be integrated with a third-party application. This may include payment gateways like Paypal or Stripe or a marketing tool that the company uses. Whatever you need, Laravel makes integrating third-party apps seamless with its clean APIs for integration. So whether your website needs a payment system in place or an automated tool to manage your marketing, Laravel is a strong contender.
Laravel Means Simple Website Maintenance
Generally speaking, websites built in Laravel are easy to maintain over time. If you want some new features added to your site (already built in Laravel), a new developer can easily pick up from where your previous developers have left the website. Due to Laravel’s standout features, like clean code, MVC architecture (which separates logic and presentation), and OOP principles, maintaining a Laravel site over time is straightforward.
Laravel is Less than Expensive
Compared to some other frameworks, Laravel is an open-source framework. This means it is free to use in any project you like at no cost. However, there is always the cost of hiring a good Laravel developer to build your website. With that in mind, development costs are further reduced as the time to build and maintain is less than some competing frameworks, allowing a Laravel project to be more cost-effective in the long run.
Laravel is an excellent choice if you are looking for scalability and optimal website performance. It’s also completely free to use and quick to install, making it desirable for any online project.
Feel free to check our Laravel Hosting page and purchase your first web hosting plan with FastComet, in case you haven’t already.
We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!