This article describes how to install Laravel using Composer in the LAMP environment. it briefly analyzes the installation of Composer in the Ubuntu Server environment and related commands and tips for installing Laravel using Composer, for more information about how to install Laravel in the LAMP environment, see the following article: Composer # php/php-tp-inst, this article briefly analyzes how to install Composer in Ubuntu Server environment and how to use Composer to install Laravel. For more information, see
This article describes how to install Laravel using Composer in the LAMP environment. We will share this with you for your reference. The details are as follows:
Install Composer
We use apt to install the Ubuntu Server:
$ sudo apt install composer
Install Laravel
First, create a project directory and enter the new directory to use Composer to install Laravel:
$ sudo mkdir -p /var/www/html/laravel/my_laravel$ cd /var/www/html/laravel/$ sudo composer create-project laravel/laravel --prefer-dist my_laravel
Because Apache in Ubuntu uses www-data users, it does not work properly to avoid permission issues. We will set the following three directories: public, storage, and vendor:
$ sudo chown -R www-data /var/www/html/laravel/my_laravel/public/$ sudo chown -R www-data /var/www/html/laravel/my_laravel/storage/$ sudo chown -R www-data /var/www/html/laravel/my_laravel/vendor/
At this point, we can use a browser to access Laravel.
192.168.56.101/laravel/my_laravel/public/
Note: 192.168.56.101 is the IP address of my VM.
The preceding section details how to install Laravel using Composer in the LAMP environment. For more information, see other related articles in the first PHP community!