Install Laravel App Cpanel

Overview

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 publichtml folder, leave the folder name blank. Click on Install. Install Laravel via Softaculous.

In this blog, we will show you How to Install Laravel in cPanel. Not only that we will try to solve all your confusion about laravel.Just make sure if you like this blog please share it with others also. Step 1: Compress the Entire Laravel Project Folder. First of all, Compress the laravel project folder on your local machine and create a zip file. Step 2: Open Shared Hosting CPanel. In this step, you need to open your shared hosting cPanel to deploy laravel project on Cpanel. And then follow the below steps: Click on ‘File Manager’.

In this article, you will learn how to host a Laravel app on a cPanel, in case you have a local server like WAMP or XAMPP, this would work to test it out before uploading it to cPanel.

The article will cover 2 steps:

  1. How to deploy your app to shared hosting.
  2. How to migrate your databases without running migration commands.

Installing LARAVEL on cPanel

the first step to host Laravel app on cPanel is to install the framework under your user, however, if you are on a Shared Hosting plan (restricted or no SSH access) you won't be able to use most of its functionalities. How to properly deploy your LARAVEL Project on a Shared Plan will be covered below in the next section.

  1. Login to your Cpanel.
  2. Under the SOFTWARE section, choose the Softaculous Apps Installer.
  3. Type Laravel in the search bar and on the next window click Install Now.
  4. On the next page fill in the requested information and choose Quick Install.
    • Choose Protocol: choose SSL or non-SSL protocol (http/https).
    • Choose Domain: the domain to install the software.
    • In Directory: name of the directory to which you wish the application be installed.

5. Click Install.

6. If the Laravel application is installed properly, you will see the message below:

How to deploy your app to shared hosting

assume you've finished building your app. I also assume you are using Laravel 5.0 – although this article would be relevant for Laravel 5.1

  1. Compress the entire project folder on your local machine. You'll get a zip file – laravelProject.zip
  2. Click on File Manager.
  3. Click on Upload.
  4. Upload the laravelProjec.zip to the root directory – not the public_html.
  5. Extract the laravelProjec.zip
  6. Open the laravelProject folder and MOVE the CONTENTS of the public folder to your cpanel’s public_html folder. You can as well delete the empty public folder now.
  7. Navigate to the public_html folder and locate the index.php file. Right-click on it and select Code Edit from the menu.
  8. This will open up another tab showing the cPanel code editor.
  9. change the following lines (22 and 36) from, According to your projects folder name.

11. Go to (http://yourdomain.com) should throw database errors (if you have models running on your app). Not to worry. The next phase is migrating your databases to your shared hosting.

Note

Please do not change the contents of your .htaccess file (Unless you know what you are doing

Migrating your tables

Install Laravel App Cpanel Windows 10

One good thing about Laravel Framework is that it enables you to quickly setup defined databases with a single command php artisan migrate. Since we are using shared hostingwe can not do this without the use of SSH. This can be done easily if you have up to 10 tables. Its straightforward so let's start:

Create a database on your web host

  1. Most cPanel comes with PHPMyAdmin and Mysql Database Wizard.
  2. Use the Mysql Database wizard to create a Database and User then assign the user to the database allowing all privileges.
  3. Note down the username and password you'll need that soon.
  4. Use the cpanel's PHPMyAdmin to create your tables. To do this efficiently, open up PHPMyAdmin on your local machine.
  5. For each table structure create the exact structure on your cPanel’s PHPMyAdmin.

Importing and exporting databases from a local machine

Install laravel app cpanel free
  1. login to PHPMyAdmin from your computer locate the database your project uses, from the toolbar find the export tool.
  2. After exporting move over to your shared hosting and do the same steps on create database section.
  3. If successfully uploaded you'll see the SuccessMessage

Final Steps

  1. On your cpanel File Manager, navigate to laravelProject.
  2. Go to config/database.php
  3. Right-click and select Code Edit.
  4. Locate line 55 – Your MySQL configuration Section.
  5. Change the username and password to your MySQL username and password from your cPanel.

Was this article helpful?

Related Articles

Table of Contents

  • Overview
  • Install a Node.js application
  • Pre-installation settings
  • Install the application
  • Test the application
  • Register the application
  • Restart the application
  • Create a custom startup file
  • Troubleshoot the application
  • The application will not create an SSL include file
  • Application port troubleshooting

Table of Contents

  • Overview
  • Install a Node.js application
  • Pre-installation settings
  • Install the application
  • Test the application
  • Register the application
  • Restart the application
  • Create a custom startup file
  • Troubleshoot the application
  • The application will not create an SSL include file
  • Application port troubleshooting

Last modified: September 9, 2021

Overview

  • Because cPanel, L.L.C. doesn’t develop Node.js, cPanel Technical Support can’t help you with these steps.
  • We recommend that only experienced system administrators perform these steps.
  • We are not responsible for any data loss.

This document describes how to install a Node.js web application. Node.js is a JavaScript runtime that allows you to build scalable web applications.

  • We recommend that you perform the steps in this document via the command line as a cPanel user unless otherwise specified.
  • You can also perform these steps in cPanel’s Terminal interface (cPanel >> Home >> Advanced >> Terminal).
  • In this document, nodejsapp represents the application’s name and 3000 represents represents an open firewall port.

For more information, read the Node.js documentation.

Install a Node.js application

Only perform the steps in this document as a cPanel user. Do not perform these steps as the root user, as this is a security risk.

Pre-installation settings

Before you begin, make certain that your hosting provider installed the following EasyApache 4 RPMs on your server:

  • ea-ruby27-mod_passenger

    • This module disables Apache’s mod_userdir module.
    • If your system runs CentOS 6, install the ea-ruby24-mod_passenger module instead.
  • ea-apache24-mod_env

  • ea-nodejs10

    We also recommend that your hosting provider install the ea-ruby27-ruby-devel module.

Install the application

To install an application, perform the following steps:

  1. Log in to the server via SSH as a cPanel user.

  2. Create the application’s directory, relative to your home directory. To do this, run the following command:

  3. Change to the application’s directory.

  4. Create the app.js file with a text editor.

    We strongly recommend that you create the file with this exact name because Passenger searches for this filename when it executes. If you create a startup file with a different name, you must specify the filename in the ‘httpd.conf’ file. To do this, follow the directions in the Create a custom startup file section below.
  5. Add the application’s configuration to the app.js file. This will resemble the following example:

Test the application

After you install the application, we recommend that you confirm it’s active. To do this, perform the following steps:

  1. Log in to the server via SSH as a cPanel user.

  2. Run the following command:

    The output will resemble will the following example:
  3. Open another terminal window and log in to the server via SSH as the same cPanel user.

  4. Run the following command:

    The output will resemble the following example:
  5. Stop the testing process by pressing CTRL + C keys in the open terminal window, or run the following command:

    This will return a list of pid (process ID) numbers of running programs containing the script name. Stop the test application by running the following command, where PIDNUMBER is the process ID:

If you wish to export the /opt/cpanel/ea-nodejs10/bin path to your environment, add the following line to your .bashrc file:

Register the application

After you install the application, register it. To do this, use cPanel’s Application Manager interface (cPanel >> Home >> Software >> Application Manager).

After you register the application, you can access the application in a web browser with the following URL:

Laravel

In this example, example.com represents your website.

Restart the application

When you want your application to restart after you edit it, create the restart.txt touch file in the application’s tmp directory. This file directs mod_passenger to restart the application after you modify it. This action applies your changes to the application.

  • You must touch the restart.txt touch file each time that you want mod_passenger to restart the application.
  • You must manually create the tmp directory. For example:

Create a custom startup file

Passenger searches for the app.js filename when it executes. If you create a startup file with a different name, you must create an include file and specify the startup filename there. If you don’t do this, your application won’t function.

To specify the new filename, perform the following steps:

  1. Create the /etc/apache2/conf.d/userdata/ssl/2_4/user/domain.nodejs.conf file with a text editor.

  2. Add the PassengerStartupFile variable and the filename as its value in a virtual host container. This will resemble the following example:

  3. Rebuild the httpd.conf file. To do this, run the following command:

  4. Restart Apache. To do this, run the following command:

Troubleshoot the application

Install Laravel App Cpanel

You can find error messages in the application’s /home/user/nodejsapp/logs directory.

Cpanel App Download

If you experience issues with your Node.js application, use Phusion Passenger’s™ Troubleshooting Passenger Standalone and Node.js documentation to troubleshoot the issue.

The application will not create an SSL include file

If your application will not create an SSL include file, it’s likely that you are using a Node.js application with an addon domain. This issue occurs when the Node.js application’s path differs from the addon domain’s document root path.

To fix this issue, you can create an SSL include file for the addon domain. To do this, perform the following steps:

  1. Complete the steps to register the application. This action creates a configuration file that the system will store in the /etc/apache2/conf.d/userdata/std/2_4/username/example.com/ directory. In this example, example.com represents the addon domain name.

  2. Copy the configuration file for your addon domain in the /etc/apache2/conf.d/userdata/std/2_4/username/example.com/ directory to the /etc/apache2/conf.d/userdata/ssl directory. To do so, use the following command:

  3. Rebuild the Apache configuration and restart Apache with the following commands:

For more information about these scripts, read The rebuildhttpdconf Script and The restartsrv Scripts documentation.

You can now access the Node.js application through the addon domain’s URL via HTTP (port 80) and HTTPS (port 443).

Application port troubleshooting

Passenger controls the port on which your Node.js application listens when it makes HTTP requests. This is known as reverse port binding. Reverse port binding allows Node.js applications to work with Passenger.

Cpanel App For Iphone

If you experience issues with the port on which your Node.js applications listen, use Phusion Passenger’s™ Reverse port binding in Node.js documentation to troubleshoot the issue.

Install Laravel App Cpanel Login

Additional Documentation