Install Laravel App Cpanel

Posted on  by 



Method 1 - Install Laravel using Composer on shared hosting

The procedure for installing Laravel 5 on shared hosting with Apache and cPanel

Login ke akun cPanel hosting mengikuti panduan berikut ini: Cara Login cPanel; Cari menu “Softaculous Apps Installer” Kemudian ketikkan “Laravel” pada kolom pencarian selanjutnya klik “Install Now” 4. Pilih nama domain yang ingin diinstallkan dan kosongkan “In Directory”. Configure cPanel. We need to edit the default web server document root and change it from publichtml to public as required by Laravel. Change Document Root for an Addon domain. Login to your cPanel at: and in the ‘Domains’ section click on the ‘Addon Domains’.

  1. Connect to hosting via SSH

  2. In cPanel open Select PHP version and choose 5.4. (I also set phar extension)

  3. Install Laravel

  4. Copy everything from myproject/public to public_html

  5. open public_html/index.php and set:

Also, add this to the top of index.php:

Method 2 - copy Laravel install to shared hosting

I've tried it on my shared hosting. Here's what I did.

  1. Install and setup Laravel on your local (meaning your local machine)

  2. Once done, copy all files to your hosting.

  3. Create a .htaccess file on your Laravel's root directory. This is to access it without the 'public' on the URL.

Method 3 - Bluehost Laravel shared hosting

  1. Setup a project Laravel 5 in localhost correctly configured
  2. Double check the server configuration of PHP 5.4
    1. This is because every little change on .htaccess file may change that config
  3. Create a directory in the same level of public_html and put the project inside of that folder.
  4. Put the content of public (Laravel 5) directly on public_html (be aware of not overwriting the .htaccess file accidentally)

Now... This is the 'tricky part'... actually not xD In Bluehost I see this structure

  • mail
  • perl5
  • php
  • public_html
  • [framework-folder]
  • ssl

Inside of public_html I can see all the files of public directory of Laravel 5

Go to index.php and edit the line 22

And the line 36

The final step is to edit the .htaccess file and add some lines

Refresh the cache of my browser and.. Victory!!

I know that this is not the absolute right way to install the framework (God, I never spoke about Composer)

Source: Laravel.io


Install Laravel App Cpanel

Web developers love Laravel framework.

Install Laravel App Cpanel

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.

Install Laravel App Cpanel Login

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

App

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

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.

Install Laravel App Cpanel Download

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.

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

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

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

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.

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.

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:

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.


Source link





Coments are closed