These codes which I have written terminal
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
Composer is working.
After that I downloaded laravel without error.
composer global require "laravel/installer"
But When I write ~/.composer/vendor/bin/laravel in terminal it gives me error
bash: /root/.composer/vendor/bin/laravel: No such file or directory
Where is my problem?I dont get it.
EDIT:
find /root/ -name laravel
./.config/composer/vendor/bin/laravel
./.config/composer/vendor/laravel
./.config/composer/vendor/laravel/installer/laravel
./.cache/composer/files/laravel
You can simply run composer create-project --prefer-dist laravel/laravel blog to install Laravel in blog directory.
Then you go into blog directory and run php artisan serve. Now your Laravel should already be online.
Check this document for the Laravel installation https://laravel.com/docs/5.3/#installing-laravel.
Related
This question already has answers here:
How to downgrade or install a specific version of Composer?
(7 answers)
Closed 1 year ago.
I want to install old version of composer. My commands are:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'baf1608c33254d00611ac1705c1d9958c817a1a33bce370c0595974b342601bd80b92a3f46067da89e3b06bff421f182') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --version=1.4.1
php -r "unlink('composer-setup.php');"
But it didn't install composer. I check with the command composer -v but unfortunately it didn't work. How can I do this?
These commands will install composer binary in composer.phar file in current working directory. You may try to verify this by running php composer.phar -v command. composer command will most like point to some global installation in your system - you need to move new binary to correct place, so it could be recognized as global command (see docs):
mv composer.phar /usr/local/bin/composer
If you have already Composer installed, you should able to use self-update command to downgrade to any version:
composer self-update 1.4.1
or
sudo -H composer self-update 1.4.1
If you came here searching for downgrading from composer 2.0 to 1.0
composer self-update --1
Curl can be used to download a specific version:
curl -O "https://getcomposer.org/download/1.10.17/composer.phar"
chmod a+x composer.phar
sudo mv composer.phar /usr/local/bin/composer
If you have installed composer v2, and want to install composer v1 in addition you can do:
wget https://getcomposer.org/composer-1.phar
chmod a+x composer-1.phar
sudo mv composer-1.phar /usr/local/bin/composer1
And use composer1 on old projects:
cd <OLD-PROJECT>
composer1 install
I'm trying to install Magento 2.1 using PHP composer.
http://idroot.net/tutorials/how-to-install-php-composer-on-centos-7/
I found the url above to install PHP composer for Centos 7.
on step 2 it failed:
curl -sS https://getcomposer.org/installer | php
this is the error I get
"curl: (6) Could not resolve host: php; Name or service not known
Thanks for the help guys!
wget https://getcomposer.org/composer.phar
chmod +x composer.phar
mv composer.phar /usr/local/bin/composer
Already tried with composer's documentation?
This method?
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Or just tried with the download page:
What don't you use yum instead of manual installation?
Use follow command:
yum install php71w-composer
you can replace php71w with other version as you like, such as php55w is php 5.5, php56w is php 5.6, php70w is php 7.0 and so on.If you meet the error message like "package php71w-composer not found", install webtatic repository follow by this.
I'm trying to install composer running the command provided on the getcomposer.org/download documentation site:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
But I get an error message saying:
Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in Command line code on line 1
Warning: copy(): Failed to enable crypto in Command line code on line 1
Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1
Yoshihiros-MacBook-Pro:~ yoshihiro$ php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Warning: hash_file(composer-setup.php): failed to open stream: No such file or directory in Command line code on line 1
Installer corrupt
Warning: unlink(composer-setup.php): No such file or directory in Command line code on line 1
Yoshihiros-MacBook-Pro:~ yoshihiro$ php composer-setup.php
Could not open input file: composer-setup.php
I'm also trying to install it globally but I can't get out of this message. Please help D:
I had same issues but this what I did:
I copy paste this into the terminal php -r "copy('http://getcomposer.org/installer', 'composer-setup.php');" on the terminal which download the composer to the directory where you are currently In.
(the problem was causing because of the https protocol)
And then
php composer-setup.php --install-dir=/usr/local/bin --filename=composer run this command, which installs the Composer to my bin folder so that i could run it globally.
Then you have to unlink the composer php -r "unlink('composer-setup.php');"
Finally check the see the Composer installed composer -V.
Good Luck !
I had the same problem-
here is the right way
clean dir > Terminal > mkdir composer
cd composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/
vim ~/.bash_profile
alias composer="php /usr/local/bin/composer.phar"
I had same issues but this what I did:
I ran curl -sS https://getcomposer.org/installer | php on my terminal which made composer to be installed on my PC.
And then I moved Composer to my bin folder so that i could run it globally mv Composer.phar usr/local/bin/composer.
It works for me as follows:
I ran
curl -sS https://getcomposer.org/installer | php
on my terminal which made composer to be installed on my PC.
And then I moved Composer to my bin folder so that I could run it globally:
mv Composer.phar usr/local/bin/composer
The instructions in Composer official page is sometimes confusing
or not working on macOS Sierra.
But installation is still simple like before.Just simply run two lines of command on your Terminal.
curl -sS https://getcomposer.org/installer | php
mv composer.phar usr/local/bin/composer
I have same problem and I try this step:
Open your terminal
Copy this code in your php folder, In My laptop, I have use lampp then I go to xampp folder.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
So, if you have get this message below:
All settings correct for using Composer
Downloading...
Composer (version 2.0.8) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
You can copy this code:
php -r "unlink('composer-setup.php');"
Untill here you have succesfully install composer
Check it with this code composer
Thanks
Please don’t use any of it. I’m not saying its wrong.
Please follow the link https://getcomposer.org/download/ for installing latest version of composer.
The reason is because hen you download from getcomposer.org you are downloading latest file like https://getcomposer.org/installer & composer-setup.php.
And comparing with wrong SHA384 hash_file (like e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae), so it will not work.
I had also the same issues to install composer after a clean install of macOS Sierra. My solution to get it work:
Open your terminal
sudo php -r "copy('http://getcomposer.org/installer', 'composer-setup.php');"
sudo php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php
sudo php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
To verify if it's all installed properly type: composer -V
You can also just put composer.phar (which is what you end up with after you do the install) wherever you want and create a symlink in /usr/local/bin/composer to it using ln -s
I use this method .and works fine for me on ubuntu 17.10
1-create file bash
1-1 Create a directory on the desktop.And then open the terminal
sudo touch sh1.sh
sudo 777 sh1.sh
2-edited file sh1.sh writing this statements
#!/bin/sh
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RESULT=$?
exit $RESULT
3-on terminal run
./sh1.sh
Please just copy the link and paste it to your terminal:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Now you can run composer without any error....
You can easily download PHP Composer by following the official documentation, here's the link
These are the steps.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
To verify if it's all installed properly type: composer -V
This will work on both Linux and macOS.
I am trying to install the braunson/fatsecret package with PHP Composer on my local XAMPP installation.
https://packagist.org/packages/braunson/fatsecret-laravel
When I try to install it with the following command:
php composer.phar require "braunson/fatsecret:dev-master"
The installation fails, and I get the following message:
Your requirements could not be resolved to an installable set of
packages.
I have installed composer (in my opinion) correctly in /Applications/XAMPP/htdocs/my-folder/ like the documentation says:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
The package is called braunson/fatsecret-laravel, as per the link you provided to Packagist. Looks like the project's readme is out of date, possibly the package changed names at some point in the past.
You should be able to just change your command to
php composer.phar require "braunson/fatsecret-laravel:dev-master"
I downloaded the project.
My task to run this project through the xampp server.
They told me to install composter to the server.
I downloaded the project into htdocs/mysite/
I install composer
C:\bin>php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
He called through С:/xamppp/php/php composer.phar
When I run project Dependencies are not tightened(yii,...)
when I
С:/xamppp/php/php composer.phar create project C:/...htdocs/mysite/
Error:InvalidArgumentExeption
Cannot find project with stability stable
My answer may not be relevant to OP question for anyone looking to install composer
Linux - Ubuntu
sudo apt-get install composer
Or ..
Manual installation based on getcomposer.org
#!/usr/bin/env bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
run these command in a bash file or one by one.
Or ..
# this answer is copied and not tested
curl -s http://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/
If I've read this correctly, are you trying to install yii?
If so, this guide should help:
http://www.yiiframework.com/wiki/392/creating-yii-applications-with-composer/
It has a link to a sample Github project too.
Get latest stable version of composer
wget https://getcomposer.org/download/latest-stable/composer.phar
Move to bin
sudo mv composer.phar /usr/bin/composer