How to Install Laravel on Hosting? Print

  • Laravel, Composer, Artisan, Advanced PHP, PHP Framework
  • 0

Laravel is a popular PHP framework that requires a few specific steps to install on your BurjHost account. Unlike WordPress, you cannot use a one-click installer. You will need SSH access or the command line.

Prerequisites:

  • A BurjHost plan that supports SSH access and the required PHP version (Laravel 10.x requires PHP 8.1+).

  • Composer (dependency manager for PHP).

Method 1: Installation via SSH (Recommended)

  1. Log in to your account via SSH (see Article 52 for SSH access).

  2. Navigate to your desired directory (e.g., public_html for the main domain, or a subfolder):
    cd ~/public_html

  3. Install Laravel using Composer:
    composer create-project laravel/laravel .
    (The dot at the end installs it in the current directory. Remove the dot to install in a subfolder like laravel-site).

  4. Set Permissions:
    Laravel needs write access to the storage and bootstrap/cache directories:
    chmod -R 775 storage
    chmod -R 775 bootstrap/cache

  5. Configure Environment:

    • Copy the example environment file: cp .env.example .env

    • Generate an application key: php artisan key:generate

  6. Edit the .env file to set your database credentials and app URL.

Method 2: Manual Upload (Without SSH)
If you don't have SSH, you can install Laravel locally and upload it:

  1. Install Laravel locally using Composer on your computer.

  2. Compress the entire folder into a ZIP file.

  3. Upload the ZIP via cPanel File Manager and extract it.

  4. Important: You may need to adjust file permissions via File Manager (folders to 755, files to 644).

Your Laravel app should now be accessible at your domain.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution