Setting up a laravel application is basically the same as any other site say wordpress. It consists of files and a database (if it uses a database). The only drawback of the Laravel application may be in its plugins if there are and those that require more permissions than shared hosting (cPanel) can provide. But in most cases it's all right because the Laravel team realized that more and more people are using Laravel on shared hosting, so what was earlier than version 5 was replaced and now it doesn't require any php functions that are usually blocked.
You can follow this instruction if you are transferring laravel from hosting to hosting or from computer to hosting. Because basically the transfer is the same regardless of where the files are located.
For this example, I used a laravel application where I installed the invoice package to see how it works, so I will use the same for installation.
- The first step is to select all the files of our application and ZIP them (it is very important that they are .zip). You can also upload files via FTP, but for this example we will use .zip because it is the most common practice of our clients.
You find the files, select them all and then zip them through the program or if you are on Windows 10, you have the option shown in the picture below

Now that we have zipped our application we need to transfer it to cPanel.
- Open cPanel and the File Manager option. Then click on the public_html folder on the left to open it and then go to upload.

In the folder we find the ZIP file that we created by zipping our application. This will start the upload and we wait until it turns green, although sometimes it is blue on the 100%, wait until it turns green.

We have indicated here to confirm that you are uploading the file to the public_html folder and that it is green as mentioned.
- The next step is to unpack our application. Let's close that tab, click on Reload in the file manager, and our uploaded file will appear in the public_html folder.


Now we will get all the files but some files are hidden such as the .env file which is very important to us. In order to see those files, do the following.
- In the upper right corner of Settings, tick show hidden files and save.


We should now see all our files as in the image below.

The next step is to transfer ALL files to the home directory. This is crucial because of security that all files are not in the public_html folder but in the home directory and the contents of the public folder will be in the public_html folder. This is a practice that everyone uses, so we will do the same in this guide.
The second thing is to leave everything as it is, but then you need to modify/create the .htaccess file so that when someone opens your site, it immediately opens the public_html folder and the index.php file that is there. You can search for the default content of the .htaccess file on the Internet.
- We select all the files and click on the move button, then in the field for the location where we send our files, leave a slash only that means that it is the home directory and then click on Move Files as in the picture below.

- Now that we have done that and public_html is left empty, we open the public folder of our application and go to select all again and again to move, then in the location field we enter a slash public_html to send all the files to the public_html folder. As in the picture below.

Now that we've done that we've just completed uploading the files.
The content of the .htaccess file in the public_html folder of our application is:
Options -MultiViews -Indexes RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]
But if we go and open the site, we will get an error (in our case, because we also use the database and we haven't set up the database yet).
An image of our error is given below.

Creation of database, database username and password and placement in our .env file
- In cPanel we find an option called MySQL Database Wizard which will help us in 3 steps to create and set it up properly. The next 3 pictures are exactly those three steps.
- The first step is creating a database.

- The second step is creating a username database and a password for that user

- The third step is to set that user's permission over the database. Tickle everything.

This completes that part. Now it is necessary to put that data in the .env file in order to connect our application to the database.
- cPanel and File Manager and in the home directory there is our .env file. Right click and edit. (if the encoding option appears, just confirm).
- You need to change the APP_URL to the url of your domain, DB_DATABASE, DB_USERNAME, DB_PASSWORD to change all that and set it with the data you created the database with above according to the instructions. If you don't remember those data and haven't saved them, you can see them and enter a new password in cPanel and MySQL Databases.

Now we need to export from our computer and import to our hosting database. If we are not going to do that, laravel has a great command for that if we did it right, and that is
php artisan migrate --seed
If you didn't work that way, you need this under the export and import base.
- First we go to localhost/phpmyadmin/ and select our database on the left and click on export and then go to Naked in the lower right corner.

- Now we go to cPanel and the phpMyAdmin option
- Again on the left we select our base, but this time we go to import.

After the import you should get a green message Import has been successfully finished,….
Now when we open our application it will open properly.

If something still doesn't work as it should and you get a 500 error, it means that there is an error in the code.
500 error debug file
You need to include debug in the .env file at the beginning of the file, and then your error log is located in storage/logs/laravel.log, by viewing that file it will write what the error is and what the problem is.