How to Install Laravel on a Mybox Hosting Account

On this page
  1. Prerequisites
  2. Connecting via SSH
  3. Installation
  4. Step 1 – Create an Empty Website
  5. Step 2 – Remove the Default Document Root
  6. Step 3 – Download Composer
  7. Step 4 – Create a Laravel Project
  8. Step 5 – Optimize the Laravel Installation
  9. Step 6 – Create a Symbolic Link
  10. Verifying the Installation
  11. Updating Laravel Permissions (Optional)
  12. Useful Artisan Commands
  13. Summary

Laravel is one of the most popular PHP frameworks for building modern web applications. This guide explains how to install Laravel on a Mybox hosting account using SSH and Composer.

Prerequisites

Before installing Laravel, make sure that:

  • SSH access is enabled for your hosting account.
  • A website has been created in the Mybox control panel.
  • PHP 8.2 or newer is selected for the website.
  • You have basic familiarity with SSH commands.

Connecting via SSH

Enable SSH access for your hosting account if it is not already enabled.

Then connect to your account using:

  • PuTTY on Windows
  • Terminal on macOS
  • Terminal on Linux

Installation

Step 1 – Create an Empty Website

In the Mybox control panel:

  1. Navigate to Websites.
  2. Click Add Website.
  3. Select Blank Website.
  4. Choose PHP 8.2 (or newer).
  5. Complete the website creation process.

Step 2 – Remove the Default Document Root

After connecting via SSH, enter your website directory:

cd yourdomain.com

Remove the default document root:

rm -rf public_html

Step 3 – Download Composer

Download the desired Composer version.

Example:

wget https://getcomposer.org/download/2.8.8/composer.phar

You can replace the version number with the latest stable release if desired.

Step 4 – Create a Laravel Project

Create a new Laravel application.

Example:

php82 composer.phar create-project --prefer-dist laravel/laravel project_name

Replace:

project_name

with your preferred application directory name.

Step 5 – Optimize the Laravel Installation

Run the following commands:

php82 -c /usr/local/php/php.ini project_name/artisan clear-compiled
php82 -c /usr/local/php/php.ini project_name/artisan optimize
php82 -c /usr/local/php/php.ini project_name/artisan key:generate

These commands:

  • Clear cached compiled files
  • Optimize the framework
  • Generate the application encryption key

Laravel stores publicly accessible files inside the public directory.

Since the web server expects website files inside public_html, create a symbolic link:

ln -s project_name/public public_html

Replace:

project_name

with your Laravel project directory name.

Verifying the Installation

Open your website in a web browser.

If the installation was successful, you should see Laravel’s default welcome page.

Updating Laravel Permissions (Optional)

If your application requires write access to storage and cache directories, make sure the following directories are writable:

storage
bootstrap/cache

Laravel uses these directories for:

  • Cache files
  • Sessions
  • Logs
  • Temporary application data

Useful Artisan Commands

Clear application cache:

php82 project_name/artisan cache:clear

Clear configuration cache:

php82 project_name/artisan config:clear

Clear route cache:

php82 project_name/artisan route:clear

Run database migrations:

php82 project_name/artisan migrate

Summary

To install Laravel on Mybox:

  1. Create a blank website with PHP 8.2 or newer.
  2. Connect via SSH.
  3. Remove the default public_html directory.
  4. Download Composer.
  5. Create a new Laravel project.
  6. Run the Laravel optimization commands.
  7. Create a symbolic link from public_html to Laravel’s public directory.

After completing these steps, your Laravel application should be available under your domain and ready for development.

Didn't find an answer?

Our support team is here for you 24/7 – write to us and we will help you sort it out.