How to set up the Laravel framework on Linux?

To set up the Laravel framework on Linux, you need to follow these steps:

  1. Make sure your Linux system has installed the necessary dependencies such as PHP, Composer, and MySQL. You can use the following commands for installation:
sudo apt-get update
sudo apt-get install php php-mysql php-mbstring php-xml composer mysql-server
  1. Install the Laravel framework. Run the following command in the terminal:
composer global require laravel/installer
  1. Create a new Laravel project. Run the following command in the directory where you want to store the project:
laravel new project-name

This will create a Laravel project named project-name.

  1. environment variables
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
  1. Generate an application key. Run the following command in the terminal:
php artisan key:generate

This will generate a unique key for your application.

  1. Start the development server. Run the following command to start Laravel’s development server:
php artisan serve

You will see a message similar to “Laravel development server started: http://127.0.0.1:8000” indicating that the server has been successfully started.

Now, you have successfully set up the Laravel framework on Linux and can begin developing your application.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds