How to Upload Laravel Project on cPanel

How to Upload Laravel Project on cPanel



Laravel is a popular PHP framework known for its elegant syntax and robust features, making it a preferred choice for web developers worldwide. While developing your Laravel project locally is convenient, eventually, you'll need to upload it to a web server for deployment. cPanel, a widely used web hosting control panel, provides an easy interface for managing web hosting accounts. In this tutorial, we'll walk through the process of uploading a Laravel project to cPanel.

Step 1: Prepare Your Laravel Project

Before uploading your Laravel project to cPanel, ensure that it's properly configured and ready for deployment. This includes:


1. Composer Dependencies: Run `composer install` to install all the required dependencies specified in your `composer.json` file.


2. Environment Configuration: Set up your `.env` file with the appropriate database credentials, app URL, and any other necessary configurations for your production environment.


3. Optimize Autoloader: Run `composer dump-autoload --optimize` to optimize the class autoloader for better performance.


4. Clear Cache: Clear the application cache by running `php artisan cache:clear` and `php artisan config:cache`.


Step 2: Compress Your Laravel Project

To make the upload process smoother, compress your Laravel project directory into a ZIP or TAR file. This reduces the overall file size and speeds up the transfer process.


Step 3: Access cPanel File Manager

Log in to your cPanel account provided by your web hosting provider. Navigate to the "File Manager" tool, which allows you to manage files and directories on your web server.


Step 4: Upload Your Compressed Laravel Project

Inside the File Manager, locate the directory where you want to upload your Laravel project. This is typically the `public_html` directory, which is the root directory for your website.


1. Click on the "Upload" button in the File Manager toolbar.

2. Choose the compressed ZIP or TAR file containing your Laravel project from your local computer.

3. Once the upload is complete, select the uploaded file and click on the "Extract" button to extract its contents.


Step 5: Move Laravel Files to the Root Directory

After extraction, you'll find your Laravel project directory within the chosen directory. Move all the files and folders from the Laravel project directory to the root directory where your website should reside (usually `public_html`).


Step 6: Update File Permissions

Ensure that the appropriate file permissions are set for your Laravel project files and directories. Directories should typically have permissions set to `755`, and files should have permissions set to `644`. You can adjust permissions using the File Manager or via SSH.


Step 7: Configure Your Domain

If you haven't already done so, configure your domain to point to the directory where you've uploaded your Laravel project. This is typically done through the "Addon Domains" or "Domains" section in cPanel.


Step 8: Finalize Configuration (Optional)

Depending on your Laravel project's requirements, you may need to perform additional configuration steps, such as setting up cron jobs, configuring SSL certificates, or adjusting PHP settings. These can be done through various sections within cPanel.



Uploading a Laravel project to cPanel is a straightforward process, but it requires attention to detail to ensure everything works smoothly in a production environment. By following the steps outlined in this guide, you'll be able to deploy your Laravel application successfully and make it accessible to users worldwide.

Post a Comment

Previous Post Next Post