ERROR message while trying to setup Composer:
192:~ biancalouisedairo$ php -r "copy('', 'poser-setup.php');"
192:~ biancalouisedairo$ php -r "if (hash_file('sha384', 'poser-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('poser-setup.php'); } echo PHP_EOL;"
Installer verified
192:~ biancalouisedairo$ php poser-setup.php --install-dir=/usr/local/bin
All settings correct for using Composer
The installation directory "/usr/local/bin" is not writable
192:~ biancalouisedairo$
ERROR message while trying to setup Composer:
192:~ biancalouisedairo$ php -r "copy('https://getposer/installer', 'poser-setup.php');"
192:~ biancalouisedairo$ php -r "if (hash_file('sha384', 'poser-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('poser-setup.php'); } echo PHP_EOL;"
Installer verified
192:~ biancalouisedairo$ php poser-setup.php --install-dir=/usr/local/bin
All settings correct for using Composer
The installation directory "/usr/local/bin" is not writable
192:~ biancalouisedairo$
Share
Improve this question
edited Nov 11, 2018 at 12:08
Zoe - Save the data dump
28.3k22 gold badges128 silver badges160 bronze badges
asked Nov 11, 2018 at 12:07
Bianca PiperBianca Piper
111 gold badge1 silver badge1 bronze badge
2
-
1
Use
sudo
then. – mario Commented Nov 11, 2018 at 12:08 - Ive tried but it says File exists. – Bianca Piper Commented Nov 11, 2018 at 12:11
5 Answers
Reset to default 2Use sudo before your mand
like this sudo php poser-setup.php --install-dir=/usr/local/bin
This will remove any already-installed Composer and install it correctly for you:
sudo rm -f /usr/local/bin/poser
EXPECTED_SIGNATURE=$(curl -s https://poser.github.io/installer.sig)
php -r "copy('https://getposer/installer', 'poser-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'poser-setup.php');")
if [ "$EXPECTED_SIGNATURE" == "$ACTUAL_SIGNATURE" ]
then
php poser-setup.php --quiet
rm poser-setup.php
sudo mv poser.phar /usr/local/bin/poser
sudo chmod 777 /usr/local/bin/poser
fi
Just incase, don't forget to cd
(cd and space) to your home/root before running the installation mands from any of the upvoted or approved answers
cd
First make a folder. Than open mand prompt or git bash on that folder than run all the mand one by one.
mkdir phpproject
cd phpproject
than run all mands one by one
php -r "copy('https://getposer/installer', 'poser-setup.php');"
php -r "if (hash_file('sha384', 'poser-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('poser-setup.php'); } echo PHP_EOL;" Installer verified
php poser-setup.php
output
All settings correct for using Composer Downloading...
Composer (version 2.3.10) successfully installed to: C:\Users\Rabbil khan\Deskto p\phpproject\poser.phar Use it: php poser.phar
... than just simply run -- php poser.phar
Because you are not root user use sudo -i to give p