Bobcares

How to install Laravel in cPanel? Here are the steps

by | Dec 3, 2018

Web developers love Laravel framework.

This is because, it eases the common tasks in web projects like authentication, routing, sessions, etc.

At Bobcares, we often receive requests from website owners to install Laravel in their cPanel accounts as part of our Outsourced Technical Support services.

Today, let’s discuss the 2 methods to install Laravel in a cPanel server.

 

How to install Laravel on cPanel server?

You can install Laravel in a cPanel account using the below methods.

  • Automatic installation via Softaculous
  • Manual installation using Composer

 

But, before we start with the installation steps, let’s take a look at the pre-requisites.

  • PHP version 5.6 or higher
  • OpenSSL PHP extension
  • Mbstring PHP extension
  • PDO PHP extension
  • Tokenizer PHP extension
  • XML PHP extension
  • Ctype PHP extension
  • JSON PHP extension
  • Phar PHP extension
  • Mcrypt PHP extension

 

Most web hosts allow you to enable these extensions through the “Select PHP Version” option in cPanel(see below).

cpanel-laravel-install

PHP Selector

 

 

Let’s now move on to the installation steps in detail.

 

1) Automatic installation via Softaculous

You can use the Softaculous option to automatically install Laravel on a cPanel server.

Our Hosting Engineers follow the below steps to install Laravel from Softaculous.

  • Go to cPanel > Softaculous Apps Installer.
  • After that, search for Laravel and click on it.
  • Click on Install Now.
  • Then, enter the folder name where Laravel will be installed.
  • If it needs to be installed in public_html folder, leave the folder name blank.
  • Click on Install

 

cpanel-laravel-install

Install Laravel via Softaculous

 

You can see that this is so easy because the entire installation is done with a single click.

However, sometimes, we have to opt for a manual installation.

2) Manual installation using Composer

Now, let’s see the steps to manually install Laravel on a cPanel server.

a) SSH access

To manually install Laravel in cPanel account,  you must have SSH(Shell access) enabled for your account.

If not, you must contact the web host and enable shell access.

 

b) Install Composer

Likewise, the next important step is to install the Composer module.

Composer is a tool for dependency management in PHP.

You can declare the libraries on which your project depends, and it will manage them for you.

To install this module, we first download the composer installer file.

cd /bin
wget https://getcomposer.org/installer

 

Before installation, our Hosting Engineers check the compatibility of the installer using the below command.

php installer --check

 

And, if everything is good, following message will be displayed.

php installer --check
All settings correct for using Composer

 

Then, we install Composer module with the below command and after successful installation, we remove the installer file.

php installer
b) Install Laravel

First, navigate to the folder where Laravel needs to be installed.

After that, our Support Engineers install Laravel with the composer create-project command.

php /bin/composer.phar create-project laravel/laravel {directory_name} --prefer-dist

 

For instance, if you need to install Laravel in a sub-directory “test“, you can replace “directory_name” as “test”.

Laravel project files are located in /public folder.

That is, if you install it in a test folder, the files will be in “/test/public/“.

Additionally, the index.php is the front controller of Laravel for all HTTP requests and it is located in /public folder.

So, to make Laravel project files publicly available, you must create a symbolic link in the public_html folder that points to public folder.

ln -s /home/username/laravel/public /home/username/public_html

 

It’s done!! Open the browser and navigate to your domain. You can see the Laravel welcome screen.

 

Common issues in Laravel install

Sometimes, Laravel install runs smoothly and sometimes errors can occur.

Based on our experience in managing cPanel servers, let’s see some of the common problems that may arise when you install Laravel.

 

a) File permission issues

Sometimes, cPanel users complain that their Laravel installation isn’t working properly.

In most of the cases, we find that installation was successful, but proper permissions for files and directories were not assigned.

The Laravel app/storage directory and the bootstrap and cache directories should be writable by the web server. Otherwise, Laravel will not run.

Our Hosting Engineers review the application and web server logs to identify the error and then assign proper permissions to the required files.

 

b) Incorrect binaries in composer.json file

Similarly, another common error that we noticed during the Laravel installation process is given below:

Parse error: syntax error, unexpected '['

 

This is due to the wrong PHP binaries specified in the composer.json file.

Here, we review and correct the binary entries under the section scripts in he composer.json file.

 

This error list is not complete. You can come up with n number of errors during manual installation.

Need assistance to install Laravel in your cPanel account? click here to talk to our experts. We’re online 24/7.

 

Conclusion

Laravel is one of the best PHP frameworks for web development. Today, we’ve discussed how our Dedicated Support Engineers install Laravel on a cPanel server.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

4 Comments

  1. Richard Francies

    Your article Awesome Thanks for this information, very informative as well as Modern.

    Reply
    • Sharaz

      Nice post! Thanks for sharing amazing content.

      Reply
  2. hirelaraveldeveloper

    Nice post! Thanks for sharing amazing content.

    Reply
  3. Joshua

    Thanks for this great post!

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF