2.8.4.2.1. Installing Laravel

There are two ways to install the Laravel 9 base script package and dependent libraries below. The instruction is based on official documentation.

  1. By default, surrounded by SSH the hosting uses PHP 5.6. According to the requirements of the framework, a version of at least 7.3 is needed, therefore change PHP version in the console is 7.3 or higher.
  2. Download the installer:
    composer global require laravel/installer
  3. Define the path to your Laravel executable so that it runs from any directory on the filesystem:
    export PATH="$PATH:~/.config/composer/vendor/bin"
  4. Change to the desired directory and create a new project:
    laravel new name_theproject
  1. By default, surrounded by SSH the hosting uses PHP 5.6. According to the requirements of the framework, a version of at least 7.3 is needed, therefore change PHP version in the console is 7.3 or higher.
  2. Run the command:
    composer create-project laravel/laravel ~/way/to/catalog/theproject

If the root directory of the site is different from www (usually Laravel project files are located in the directory public), then you can set the desired root directory in site settings or write the following directives in the file .htaccess:

# www/.htaccess
 
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule ((?s).*) public/$1 [L]
</IfModule>

Also (if the root directory is specified via .htaccess), you need to create a .htaccess file in the directory public and write the following directives in it:

# www/public/.htaccess
 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
Content