Laravel is one of the free and open source PHP web application framework which is designed for development of Model View Controller web applications.

Here we are discussing about steps to install Laravel on a cPanel server manually.

1. You have the shell access enabled for your cPanel account in-order to make it work. If you do not have the shell access, please contact your hosting provider and then ask them to enable it for your account.

2. Once you have SSH access enabled for your account, login to your server and install via SSH and install composer, which is a PHP dependency manager which is important for the working of Laravel. Composer requires PHP ‘phar’ module installed on your server hence first check whether ‘phar’ module installed or not.
#php -m | grep phar
If you found phar module is not installed, install it on the server (better to use easyapache to install it since your server is cPanel based).
Composer installation
You can download Composer using website given below:
Installation code is given below.
myserver [~]# cd bin/
myserver [~/bin]# wget
myserver [~/bin]# php installer –check
All settings on the server correct for using Composer
(this section will show some errors if you didn’t install PHP ‘phar’ extension.)
myserver [~/bin]# php installer
All settings on the server correct for using Composer
Composer is successfully installed to: /home/user/bin/composer.phar
Use it: php composer.phar
myserver [~/bin]# rm -f installer

3. Add following lines to the file ~/.bashrc to run commands as “composer” instead of full command.
alias php=”php -d disable_functions=”
alias composer=”php ~/bin/composer.phar”
The parameters on the first line is important since composer requires some functions to be disabled (example: proc_open, escapeshellarg, etc..) on the PHP configuration file. Now the Composer is prepared on your server for Laravel installation.

4. Laravel installation
If you have completed the steps given above as root, you need to switch to the user before proceeding with the rest of steps.
Prerequisites for the Laravel installation:
a. Make sure you have enabled PHP extensions ‘phar’ and ‘json’ for your domain.
b. Make sure you have enabled “proc_open” function in the PHP configuration file.
Go to the user’s preferred directory and do the following steps.
user@myserver [~]# mkdir project
user@myserver [~]# cd project/
user@myserver [~/project]# composer create-project laravel/laravel –prefer-dist
The composer will now able to download and install the Laravel.
Note: For the smooth working of Laravel, it is required about 380-400 MB memory. So you need to change the allowed memory limit for the user in the PHP configuration file.

5. You need to remove public_html folder from your user’s home directory and make symbolic link to the public folder for our Laravel project. Make sure that your public_html folder empty. If you need any important data here, please backup it to a safe place before proceeding with this.
user@myserver[~]# cd ~
user@myserver[~]# rm -rf public_html
user@myserver[~]# ln -s project/laravel/public/ public_html
If everything is successful, you can see Laravel’s welcome page when you access your website, which will be like below image.


That’s it!