Setting Up Composer for PHP 8.1 on Ubuntu 22 04



Setting Up Composer for PHP 8.1 on Ubuntu 22 04

Setting Up Composer for PHP 8.1 on Ubuntu 22 04

PHP is a popular server scripting language known for creating dynamic and interactive web pages. Getting up and running with your language of choice is the first step in learning to program.

Earlier we installed php on the server and now we setting up a local programming environment via the command line. You will also install a dependency manager, Composer, and test your installation by running a script.

Commands Used
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
echo $HASH

php -r “if (hash_file(‘SHA384’, ‘/tmp/composer-setup.php’) === ‘$HASH’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

sudo php /tmp/composer-setup.php –install-dir=/usr/local/bin –filename=composer

composer
cd ~
mkdir example-project
cd example-project
composer init
nano hello.php
php hello.php

Useful Links
VPS/VDS – https://www.mivocloud.com/