How to install Laravel in WHM/cPanel server

Installing Laravel in a WHM/cPanel server

Laravel is a PHP framework used to develop PHP based applications in Linux systems. Laravel is especially designed for easy development of web applications. It supports multi-platform and allows the users to develop the MVC web applications. Installation of Laravel in cPanel is explained in this manual.

To install Laravel dependencies

Before starting with the installation, enable the shell access in the cPanel. Run the following command to download the Composer and also change the directory to bin.

[root@linuxhelp ~]# cd /bin
[root@linuxhelp /bin]# wget https://getcomposer.org/installer 
--2016-09-21 14:20:16--  https://getcomposer.org/installer
Resolving getcomposer.org... 87.98.253.108, 2001:41d0:a:7b19::2
Connecting to getcomposer.org|87.98.253.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 293630 (287K) [application/octet-stream]
Saving to: “ installer” 

100%[=================================================================================================> ] 293,630      321K/s   in 0.9s    

2016-09-21 14:20:20 (321 KB/s) - “ installer”  saved [293630/293630]


Now check the compatibility of the installer by running the following command.

[root@linuxhelp /bin]# php installer --check 
All settings correct for using Composer


Once the compatibilty is successfully verified, download the php installer.

[root@linuxhelp /bin]# php installer 
Downloading...
.
.
.
Composer successfully installed to: /bin/composer.phar
Use it: php composer.phar
[root@linuxhelp /bin]# rm -f installer 

After installing the composer, continue as user to proceed further.

Navigate to the cPanel user’ s directory and run the following command to install Laravel.

[user@linuxhelp ~]$ php /bin/composer.phar create-project laravel/laravel --prefer-dist 


After installing the Laravel, point Laravel’ s public directory to public_html directory as a symbolic link as shown below.Before you point it to the public_html directory remove the public_html directory.

[user@linuxhelp /home/user]$ rm -rf public_html
[user@linuxhelp /home/user]$ ln -s laravel/public/ public_html 

Once all the setup is done, open the browser and navigate to the respective domain. In my case " laravel.linuxhelp.com" .

Tag : WHM cPanel
Comment
ryandeschaine
Oct 31 2021
Navigate to Software -> EasyApache4
Click the button that says Customize next to Currently Installed Packages
Click PHP Extensions
Search for Fileinfo in the search bar and select the extensions you would like to install
oliverusselldev
Jan 11 2018
Isn't a vps or cloud better than cPanel based shared hosting, especially for Laravel? Shared server are not good for the security and performance of a Laravel app. Whereas, a dedicated server on cloud gives all the resources to your app only, which means better performance and security. If someone who doesn't have sysadmin skill to setup a cloud server, then they can use tools, like Cloudways Laravel hosting platform, to host their app quickly on a cloud server.
jagannatharumugam
Jun 06 2017
Is the download got completed without any interrupt right??
Add a comment
FAQ
Q
How do I log in to my cPanel interface with SSL certificate?
A
To log in to your cPanel interface, enter one of the following URLs in your address bar:
for SSL (more security):
https://example.com:2083
Q
Do I have two domains and two different web hosts on the same cPanel account?
A
No, because the accounts are on different web servers.

You can have multiple domains on one cPanel account if you use addon domains or aliases.
Q
How do I log in to my cPanel interface?
A
How do I log in to my cPanel interface?
To log in to your cPanel interface, enter one of the following URLs in your address bar:

http://example.com:2082
Q
Why the need the Laravel installation on WHM and Cpanel?
A
Laravel is a PHP framework used to develop PHP based applications in Linux systems. Laravel is especially designed for easy development of web applications. It supports multi-platform and all
Q
Does I change the root user’s default shell?
A
cPanel requires the root user to use the bash shell by default. Other users can use shells that are not bash if the system administrator wishes to make this an option.