For Ubuntu 20.04, first you will need to have php-cli:
sudo apt-get install php7.4-cli
and this will install the command line /usr/bin/php.
Next is to download composer:
https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
Copy the downloaded file "composer.phar" into a path in your home directory (where you have write control, eg, $HOME/bin):
(you can also get the Ubuntu’s composer from its distribution via "sudo apt-get install composer" but will be not the latest, just compare and check via "composer.phar –version")
export PATH=$PATH:$HOME/bin
mv composer.phar ~/bin/composer2310
(to emphasize the version is 2.3.10)
Detail installation instruction are available here:
https://laravel.com/docs/7.x/installation
So to install laravel the command will be "composer2310 global require laravel/installer" instead.
Halfway you may encounter errors like this:
The cause of the error is because I have installed other stuff with composer before, and the composer is Ubuntu’s original version, thus resulting in version pollution. To overcome these, delete the entire directory where composer dependencies are installed:
"mv ~/.config/composer/ /tmp" as shown below:
Now laravel installation succeeded, and it goes into $HOME/.config/composer/vendor/bin directory, so put that into the $PATH (so that you can issue laravel command):
export PATH=$PATH:$HOME/.config/composer/vendor/bin
(You can put that into the .bashrc and start a new terminal)
The "autoload" files you see above are located in the following directories:
Now use the laravel command (https://laravel.com/docs/7.x/installation):
An error occurred.
Similarly following alternatively instruction at:
https://www.tutorialspoint.com/laravel/laravel_installation.htm
composer2310 create-project laravel/laravel –prefer-dist
I got this error:
Solution is to install:
sudo apt-get install php-xml
Retry again:
And ending with:

the command "php artisan" being to complete certain tasks.
And finally to serve the webpages:
And the new blog command succeeded as well:
And at the end of of creation:
More information about composer are here:
You must be logged in to post a comment.