Remove composer - composer-php

I installed composer while trying to install cakePhp, but the installation was not successful and I want to uninstall composer.
I am not finding any way to do this.
For the installation I used the command curl -s https://getcomposer.org/installer | php
I am working in linux

During the installation you got a message
Composer successfully installed to: ... this indicates where Composer was installed. But you might also search for the file composer.phar on your system.
Then simply:
Delete the file composer.phar.
Delete the Cache Folder:
Linux: /home/<user>/.composer
Windows: C:\Users\<username>\AppData\Roaming\Composer
That's it.

Uninstall composer
To remove just composer package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal:
sudo apt-get remove composer
Uninstall composer and it's dependent packages
To remove the composer package and any other dependant package which are no longer needed from Ubuntu Xenial.
sudo apt-get remove --auto-remove composer
Purging composer
If you also want to delete configuration and/or data files of composer from Ubuntu Xenial then this will work:
sudo apt-get purge composer
To delete configuration and/or data files of composer and it's dependencies from Ubuntu Xenial then execute:
sudo apt-get purge --auto-remove composer
https://www.howtoinstall.co/en/ubuntu/xenial/composer?action=remove

Additional information about removing/uninstalling composer
Answers above did not help me, but what did help me is removing:
~/.cache/composer
~/.local/share/composer
~/.config/composer
Hope this helps.

If you install the composer as global on Ubuntu, you just need to find the composer location.
Use command
type composer
or
where composer
For Mac users, use command:
which composer
and then just remove the folder using rm command.

curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer
export PATH="$HOME/.composer/vendor/bin:$PATH"
If you have installed by this way simply
Delete composer.phar from where you've putted it.
In this case path will be /usr/local/bin/composer
Run this command
sudo rm /usr/local/bin/composer/composer.phar
Note: There is no need to delete the exported path.

Find the Location of the Composer by typing this command
whereis composer
Then You will get the output like this
composer: /usr/local/bin/composer
then cd /usr/local/bin/
then remove composer by this command
sudo rm -r composer

Related

Question about laravel installation to laravel team members [duplicate]

When I run a composer update I get this error message:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to download psr/log from dist: The zip extension and unzip command are both missing, skipping.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
Now trying to download from source
What do I need to do to enable the zip and unzip commands so that composer can download dependencies?
Depending on your flavour of Linux and PHP version these may vary.
(sudo) yum install zip unzip php-zip
(sudo) apt install zip unzip php-zip
This is a very commonly asked question, you'll be able to find more useful info in the aether by searching <distro> php <version> zip extension.
For servers with PHP 5.6
sudo apt-get install zip unzip php5.6-zip
Not to belabor the point, but if you are working in a Dockerfile, you would solve this particular issue with Composer by installing the unzip utility. Below is an example using the official PHP image to install unzip and the zip PHP extension for good measure.
FROM php:7.4-apache
# Install Composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Install unzip utility and libs needed by zip PHP extension
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libzip-dev \
unzip
RUN docker-php-ext-install zip
This is a helpful GitHub issue where the above is lovingly lifted from.
For Debian Jessie (which is the current default for the PHP image on Docker Hub):
apt-get install --yes zip unzip php-pclzip
You can omit the --yes, but it's useful when you're RUN-ing it in a Dockerfile.
For older Ubuntu distros i.e 16.04, 14.04, 12.04 etc
sudo apt-get install zip unzip php7.0-zip
I had PHP7.2 on a Ubuntu 16.04 server and it solved my problem:
sudo apt-get install zip unzip php-zip
Update
Tried this for Ubuntu 18.04 and worked as well.
I'm Using Ubuntu and with the following command worked
apt-get install --yes zip unzip
In case you're using a locale development environment like XAMPP, just locate the php.ini file (C:\xampp\php in my case), open it and remove the semicolon from the following line.
;extension=zip
Restart your Apache webserver and it will work fine.
On docker with image php:7.2-apache I just needed zip and unzip. No need for php-zip :
apt-get install zip unzip
or Dockerfile
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "zip"]
RUN ["apt-get", "install", "-y", "unzip"]
If you are using Ubuntu and PHP 7.2, use this...
sudo apt-get update
sudo apt-get install zip unzip php7.2-zip
I got this error when I installed Laravel 5.5 on my digitalocean cloud server (Ubuntu 18.04 and PHP 7.2) and the following command fixed it.
sudo apt install zip unzip php7.2-zip
For PHP8.2 (Windows)
As stated here: https://www.php.net/manual/en/zip.installation.php#zip.installation.new.windows
As of PHP 8.2.0, php_zip.dll DLL must be enabled in php.ini. Previously, this extension was built-in.
You will need to manually enable this extension within your php.ini by adding extension=php_zip.dll
For a list of installed extensions you can run:
php -m
or if you have grep installed even easier would be:
php -m | grep "zip"
Actually composer nowadays seems to work without the zip command line command, so installing php-zip should be enough --- BUT it would display a warning:
As there is no 'unzip' command installed zip files are being unpacked using the
PHP zip extension.
This may cause invalid reports of corrupted archives. Installing 'unzip' may
remediate them.
See also Is there a problem with using php-zip (composer warns about it)
PHP-ZIP needs some dependancies or library missing, depends on the image from Dockerfile you need to install them first
RUN set -eux \
&& apt-get update \
&& apt-get install -y libzip-dev zlib1g-dev \
&& docker-php-ext-install zip
PHP 8.1
apt-get install --yes zip
The shortest command to fix it on Debian and Ubuntu (dependencies will be installed automatically):
sudo apt install php-zip
Try this for PHP 7.4:
sudo apt-get install zip unzip php7.4-zip
And for PHP 8.0:
sudo apt-get install zip unzip php8.0-zip
After run
apt install php-zip
and run again
composer require ...
I get the next warning and suggestion
As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' or '7z' (21.01+) may remediate them.
As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' or '7z' (21.01+) may remediate them.
So I suggest install unzip first.
apt install unzip
Please check your composer status first
composer diagnose
If the status showing
zip: extension not found, unzip not available, 7-Zip not available
then
Open your XAMPP Server
Apache -> config button ->Click "PHP(php.ini)"
Find "zip"
";extension = zip will shown
Remove the semicolon and save the file
Restart your XAMPP Apache
Now
composer create-project laravel/laravel <<project_name>>
or
laravel new <<project_name>>
apt-get install zip
I'm running a docker container and this helped me
docker-compose exec app apt-get install zip
install 7 zip from this site https://www.7-zip.org/download.html this software unzips the files for you and solvesd the errors

Unable to install composer globally on Mac OS Catalina

I want to install composer for laravel development on my latest version of mac OS. I followed all the step by step instructions to install composer on the website and it installed composer.phar. So I have to move to /usr/local/bin/composer for it to work.
I ran the usual command:
mv composer.phar /usr/local/bin/composer
and it gave an error saying /usr/local/bin/composer: No such file or directory
I even added a sudo command in front to see if it works and received the same error. I looked up other solution telling me to make a new directory there, but it wouldn't let me do so and gave me a permission denied error.
You should create the directory manually before proceeding:
sudo mkdir -p /usr/local/bin
then
sudo mv composer.phar /usr/local/bin/composer
For solving your second problem
It needs zip extension,
Check your PHP version first
php -v
If for instance PHP version is 7.2, then try below command (use your PHP version)
brew update
brew install php#7.2
brew link php#7.2

Issues installing composer correctly on OS X El Capitan

I know there are some questions about how to install composer on SO, but they did not help me.
I am trying to install composer (for laravel). I have OS X El Capitan.
I downloaded composer like this:
$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /Users/blckbird/composer.phar
Use it: php composer.par
Next, I tried to execute the laravel installation:
composer global require "laravel/installer"
Which did not work because:
-bash: composer: command not found
So I tried:
sudo mv composer.phar /usr/local/composer
Which worked, however, I still can not execute composer (same error as above).
What am I doing wrong and how can I install composer correct?
Since your composer.phar is installed in /Users/blckbird/, try this for global installation:
sudo mv /Users/blckbird/composer.phar /usr/local/bin/composer
Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin. More info.

need help installing drush on mac

I'm on a mac. And I user MAMP a lot. I'm pretty new to command line and I'm trying to install Drush. I see I need to install composer first (according to what I read at drush-ops, so I did. Here's the commands I put in:
my-MacBook-Pro:~ mycomputername$ curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /Users/myname/composer.phar
Use it: php composer.phar
my-MacBook-Pro:~ mycomputername$ mv composer.phar /usr/local/bin/composer
mv: rename composer.phar to /usr/local/bin/composer: Permission denied
my-MacBook-Pro:~ mycomputername$ sudo mv composer.phar /usr/local/bin/composer
Password:
after which I did a command "composer about" to check and I got something back so I know it installed. so when i entered:
my-MacBook-Pro:~ mycomputername$ composer global require drush/drush:6.*
Changed current directory to /Users/myname/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing drush/drush (6.2.0)
Downloading: 100%
Writing lock file
Generating autoload files
...and did a "drush status" I got:
my-MacBook-Pro:~ mycomputername$ drush status
-bash: drush: command not found
...so apparently it installed but I should be able to find it. What should I do next? do i need to create and alias or what?
When running drush status you should get something like this
PHP executable : /Applications/MAMP/bin/php/php5.5.10/bin/php
PHP configuration : /Applications/MAMP/bin/php/php5.5.10/conf/php.ini
PHP OS : Darwin
Drush version : 6.2.0
Drush configuration :
Drush alias files :
I installed drush doing just this command
brew install drush
Brew is very helpful to install things in command line, I recommend you install brew.
(http://brew.sh/)
Much simpler answer! Just quote the version string :) You don't need to switch to Brew from Composer.
composer global require "drush/drush:7.*"
Here's more info about using Composer to manage Drush...
http://whaaat.com/installing-drush-8-using-composer
Download drush.tar.gz to your desktop (or wherever)
Jump across to the Terminal
cd ~/Desktop
Extract it with
tar -zxf drush.tar.gz
Move it to /usr/local/lib
sudo mv drush /usr/local/lib/
Make it executable
sudo chmod u+x /usr/local/lib/drush/drush
Then stick it in /usr/bin/ so that you can run it from anywhere
sudo ln -s /usr/local/lib/drush/drush /usr/bin/drush

Trying to install composer to get set up with Laravel framework

I am trying to install composer on my Mac so that I can use the Laravel framework. I successfully downloaded composer through the terminal, and then I moved composer.phar to to usr/local/bin using the command: sudo mv composer.phar /usr/local/bin.
I then changed directories to my root directory where I have the laravel-master files. After changing to this directory in the terminal, and then using the command: composer install
I receive the error: -bash: composer: command not found
I have tried other variations (such as php composer.phar install, etc..), however, I keep receiving the same error.
Any help would be much appreciated. Thank you!
Make sure that /usr/local/bin is in your $PATH
$ echo $PATH
Then execute
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
^^^^^^^^ you didn't rename it
For reference see
Installing composer.phar globally on *nix
I'm running Mavericks and had same problem. I changed /usr/local/bin/composer to /usr/bin/composer and it worked for me.
for mac os x Mavericks and Yosemite El capitan
Change
sudo mv composer.phar /usr/local/bin/composer
To
sudo mv composer.phar /usr/bin/composer
Now if you just write composer in terminal, it will show you all available commands
Then "if running MAMP" navagate you htdocs folder and run
composer create-project laravel/laravel laratest
Hope that helps
A quick copy-paste version including sudo:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Now in 2017 I am using MacOS SIERRA 10.12.6 and sudo mv composer.phar /usr/bin/composer doesn't work. It works for me sudo mv composer.phar /usr/local/bin/composer. Now I can run composer instead of php composer.pha

Resources