Installing Laravel on cPanel through SSH
Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching. Before installing Laravel, you must first install Composer. It is a tool which facilitates dependency management for PHP developers and programmers.
To begin downloading Composer installer file, enter following command.
To check the downloaded installer file, enter the following command with –check parameter.
php installer --check
In order to install Composer through the installer file, use the php extension command without using any parameters.
By running this command, a phar file will be created with the name Composer.phar. To view the list of files and folder at current directory use ls command.
Also there is a possibility to view this file through the cPanel interface.
To enhance your host security, we recommend to remove the installer file. In order to remove this file use the following command.
rm -f installer
To viewing Composer commands, use the follwoing command:
To create Laravel project in Composer run create-project command.
php composer.phar create-project laravel/laravel --prefer-dist
By running this command Laravel installation steps will be started. Wait until these steps are completed.
After completion of the installation the following message will be displayed:
Application key set successfully
After installing Laravel a folder with larvael name (which we set in previous command) will be created.
Given that web pages loading in cPanel are started from public_html folder and created projects in Laravel started from public folder, we must make a link between these two folders. This action will cause that site loading started from public folder directly.
First of all remove public_html folder with below command.
rm –rf public_html
Now you must create public_html folder which linked to public folder into laravel folder. To do so, enter the command below:
ln –s laravel/public public_html
At this step Laravel installation steps are finished and you can see Laravel default page when loading your domain name.