Installing Laravel and Composer on a cPanel Server

Posted at May 18, 2017 at 6:14 pm by Jithin

Laravel is a free, open-source PHP web framework intended for the development of web applications. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases.  Laravel is regarded as one of the most popular PHP frameworks, together with Symfony2, Nette, CodeIgniter, Yii2 and other frameworks. 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, queueing, and caching. Laravel is accessible, providing powerful tools needed for large, robust applications. It supports multi-platform and allows users to develop MVC web applications.

 

Server Requirements

The Laravel framework has a few system requirements. You will need to make sure your server meets the following requirements:

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

 

Laravel automatic installation via the Softaculous script installer

Laravel can be automatically installed in a cPanel server using the script installer software Softaculous. Log into cPanel and find the Softaculous menu in Software and Services section. Once done, you will be redirected to the Softaculous main page. Type Laravel in the search bar and click on the result. Move to Install tab, there you will be prompted to choose the folder where Laravel will be installed. Feel free to choose the one you need (note that this directory will be created by Softaculous). This is the easiest way of installing Laravel.

 

Laravel manual installation

Laravel utilizes Composer to manage its dependencies. Before using Laravel, make sure you have Composer installed on your machine. It is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on, and it will manage them for you. For installing composer, SSH to the server, run these commands below.

# cd /bin

#wget https://getcomposer.org/installer

Before installing let’s check our compatibility by using the following command.

#php installer –check

All settings correct for using Composer

If everything looks good let’s install Composer.

#php installer

Downloading…

Composer successfully installed to: /bin/composer.phar

Use it: php composer.phar

Now Composer has been installed, we can delete the installer file.

#rm -f installer

Now we can use this Composer to install Laravel. Run the following command to install Laravel.

#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.

#rm -rf public_html

# ln -s laravel/public/ public_html

Once all the setup is done, open the browser and navigate to the respective domain. The installation is complete and requires some configuration settings to be tweaked.

 

Configuration settings for Laravel

 Public Directory

After installing Laravel, you should configure your web server’s document/web root to be the public directory. The index.php in this directory serves as the front controller for all HTTP requests entering your application.

 

Configuration Files

All of the configuration files for the Laravel framework are stored in the config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.

 

Directory Permissions

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

 

If you need any further help please contact our support department.

 

 

0.00 avg. rating (0% score) - 0 votes

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply