How to completely uninstall symfony and composer from a mac - php

I want to completely remove symfony and composer from my mac. I have been googling for five hours and no documentation can be found on how to uninstall composer and symfony completely from my mac. Why is that so hard to find? even on the Symfony website.

Symfony on your computer is just a folder containing the framework and the structure of the files, so you can delete that folder and you are done. Composer is just an binary file (phar) that can run on the command line. Locate where that file is and delete it.

Symfony could be anywhere on your mac.
The 'installer' for mac that comes from here https://symfony.com/download (dd 2019/10) dumps symfony in your home directory in ~/.symfony . I dislike that, too.
ls -al ~/.symfony
if it's there,
rm -rf ~/.symfony
That 'installer' suggests you may want to move it here
ls -al /usr/local/bin/symfony
if it's there
rm -rf /usr/local/bin/symfony

I agree with the above answer to
rm -rf ~/.symfony
but you do not need to run ls to check beforehand, if it's there, it is going to be deleted. If not, it is being ignored.
Better do
whereis symfony
to check where your binary is and delete it.
Last but not least check if you have installed it via apt, this is a valid solution:
cd /etc/apt/sources.list.d && ls | grep symfony-cli
sudo rm symfony-cli.list && sudo apt update
This will avoid checking for updates on every apt update

Related

Is there a way to hide "funding" messages when running composer commands?

When using Composer, sometimes messages are displayed after installing or updating:
X packages you are using are looking for funding.
Use the `composer fund` command to find out more!
I want to know if there's a solution similar to this answer for npm, but for Composer.
Is there a way to hide the messages about projects needing funding? I checked the output of composer --help and didn't see any obvious flags.
There is no specific flag to target those two lines.
You can always use --quiet to get rid of all output, and have a completely silent run.
If for some reason you are particularly bothered by those two lines, but do not want to lose the rest of the output, you could always pipe stderr through grep and exclude those lines:
composer update 2> >(grep -v "composer fund" | grep -v "looking for funding")
Which results in:
Notice in the screenshot above the conspicuous lack of any reference to funding.
If all this is worth doing or not, I'll leave up to you.
Spam! In your terminal! Worse when "the good guys" do it!
But this is open source, so let's fix it.
You'll need to already have Composer installed for this (you need Composer to compile Composer like this).
You'll also need jq.
All together:
sudo apt install jq
cd "$(mktemp -d)"
ver=$(curl -s 'https://getcomposer.org/versions' | jq -r '.stable[0].version')
git clone https://github.com/composer/composer.git .
git checkout ${ver}
unset ver
sed -Ei 's/^(\s+if\s?\()\$fundingCount(\) \{)$/\1FALSE\2/g' ./src/Composer/Installer.php
composer install
composer compile
composer_location=$(which composer)
if [[ -f "${composer_location}" ]]; then
\cp -f composer.phar "${composer_location}"
chmod u+x "${composer_location}"
fi
unset composer_location
Separately:
Install jq:
sudo apt install jq
Make a temporary folder and change directory to it:
cd "$(mktemp -d)"
Get the version number of the latest stable Composer and store it in the ver variable:
ver=$(curl -s 'https://getcomposer.org/versions' | jq -r '.stable[0].version')
Clone the Composer git repository to this temporary directory and check out the code at the latest stable version of Composer:
git clone https://github.com/composer/composer.git .
git checkout ${ver}
Clean up after ourselves, unsetting the ver variable which we don't plan to use again.
unset ver
Replace if ($fundingCount) { with if (FALSE) { in src/Composer/Installer.php:
sed -Ei 's/^(\s+if\s?\()\$fundingCount(\) \{)$/\1FALSE\2/g' ./src/Composer/Installer.php
Obtain the dependencies for compiling Composer, but using Composer (which is why you need Composer installed first). I mean, you can do this manually, but heck, why.
composer install
Compose a new composer.phar with this current, altered code base:
composer compile
Store the current location of teh Composer binary in a variable.
composer_location=$(which composer)
Just in case you aliased the composer command, in which case that wouldn't have saves a file name's location, we check if it is a file and then proceed to replace it with our new one and make our new one executable by you, the user.
if [[ -f "${composer_location}" ]]; then
\cp -f composer.phar "${composer_location}"
chmod u+x "${composer_location}"
fi
That backslash before the cp is also an alias buster. Often people alias cp to cp -i and we just want this to work right now.
Finally just unset the composer_location variable to be neat.
If you follow the regex in that sed line, great, if not, it is best to skip that line and manually apply the change so that you know what is happening on your own device, vim src/Composer/Installer.php then replace if ($fundingCount) { with if (FALSE) {.
Off course this means you are running an unsigned copy of composer (with the alteration being your own). But since they breached your trust already who cares about thát "trust" chain.
Also, if you run composer self-update it will replace your Composer with an unpatched one again and you will have to follow these steps again. Since they breached your trust (yes again) best to update manually like this anyway (just follow these steps again and you will update too), I just put it in Ansible for all our company's developers' desktops.

permission denied for composer in /usr/local/bin/

I followed the documentation on https://getcomposer.org/doc/00-intro.md#globally to install composer globally on arch linux. When I do composer self-update, I get this message:
[ErrorException]
rename(/home/hannes/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied
The permissions in /usr/local/bin/ (I changed them to 777, but it did not help):
-rwxrwxrwx 1 hannes users 1104202 30. Mai 18:07 composer
In my home directory I did this:
sudo chmod -R 777 .composer/
In /etc/php/php.ini, the open_basedir looks so:
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/usr/local/bin/
I also tried sudo composer self-update but it did not work as well and is possibly not the right way. (?). What else could I try to make this work?
On Ubuntu server >= 16.04
FIRST
sudo rm /usr/local/bin/composer
AND
cd ~/.cache/composer
chmod 755 composer-temp.phar
sudo mv composer-temp.phar /usr/local/bin/composer
this might be the case if you have downloaded composer.phar directly ,
but not by running php composer-setup.php
make composer.phar executable with following command before moving it to /usr/local/bin/composer or after moving
sudo chmod 755 composer.phar
composer-setup.php will make this change for us by default
You should check the permissions of the directory /usr/local/bin/, not just the file within. The process has to write both, the file and into the directory which both must be granted.
Apart from that, a general hint: do not always set everything to 777. There is no reason for that and it makes your system vulnerable.
According to the line you posted in the last comment the directory is currently writeable only for the root user himself. That would explain the error you get. You should not make your own user account the owner, Linux systems are multi user environments. Instead think about one of these approaches:
add the account that is meant to execute the composer to the group root (a user account can belong to several groups) and make the directory group writeable
change the groups ownership of the directory to a group that account is a member of and make the directory group writeable
use the sudo utility to install and update the composer utility
The last option is the typically chosen and preferred one. It leaves permissions as they are (conservative) and only uses raised privileges for system maintenance jobs like installation and upgrade.
Use sudo command for any command which writes to root files of folder. It worked for me.
use sudo "your command"
Even after moving the file via sudo mv composer.phar /usr/local/bin/composer I was getting a permission error when trying to run the composer command. sudo chmod 755 /usr/local/bin/composer fixed things for me.
You could temporarily add the rights to your working user, then update composer w/o errors and then get back the rights.
sudo chmod 777 /usr/bin/
composer self-update
sudo chmod 755 /usr/bin/
Now, there is a package for composer in arch linux which works for me:
sudo pacman -S composer
This did the job for me on Centos 7
chown -R apache:apache path/to/composer
chmod 755 path/to/composer
make sure composer already at /usr/local/bin and then do following things
chmod 755 composer
if permission denied, add sudo
For those who are using shared server here are the steps.
Let's first download composer file.
cd ~
curl -sS https://getcomposer.org/installer | php
Now we can access composer by:
~/composer.phar
Assuming you have /public_html in root directory, here are the steps to use latest composer.
cd public_html
~/composer.phar update
In future, if you want to update composer:
~/composer.phar self-update
Hope this is helpful.
My solution on macOs was the following:
First delete the directory yo created. Somehing like '/usr/local/bin/composer' using this command: rmdir /usr/local/bin/composer.
Now try to install composer again using Homebrew :
Step 1: brew install composer.
Step 2: brew link composer.
Now you can run composer in terminal.
For composer 2
sudo composer self-update --2
For composer 1
sudo composer self-update --1
if permission denied you should use the command with sudo like:
sudo composer self-update

"sudo composer" command works but "composer" is not?

This is going to be easy one I guess. On my OS X - Yosemite I have copied composer.phar to my /usr/bin directory. I have been using it for a while but today I needed to run "composer update". It didnt work of course so I ran "sudo composer update". Then I got the message "command composer not found". Chmm
I copied composer to /usr/local/bin according to the documentation and now "sudo composer" works like charm. BUT when I run "composer" without sudo, it still uses the old one in "/usr/bin" directory. So I deleted it.
Now composer works only with sudo command. I get "Could not open input file: /usr/bin/composer.phar" otherwise. What should I do to point command "composer" to the new location in /usr/local/bin?
Another alternative to get a nice composer command instead of composer.phar:
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
$ ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
Edit:
/etc/bashrc
Add this to that file:
alias composer="php /usr/local/bin/composer"
run:
source /etc/bashrc
Composer should now run without sudo.
Okay, I encountered issues of having to run composer commands with sudo as well, but in order to get it working without throwing this kind of error (in Ubuntu 15.10):
[ErrorException]
copy(/home/randomuser/.composer/cache/files/barryvdh/laravel-cors/056068736ff8f002514178e1416c7665732eaddc.zip): failed to open stream: Permission denied
What simply solved the issue for me is:
Navigating to my home directory $ cd
Changing the ownership of .composer with: sudo chown -R $USER:$USER .composer/
Then composer install works smoothly.
PS: this might be different for other situation.
Hope this helps :)
i will answer you how i solve it in my Ubuntu 16.10 and you can compare yours
my composer folder set in
/home/abdallah/.composer/
i only give this file the 777 permission so can be reached by any user group
sudo chmod -R 777 /home/abdallah/.composer/
and that is it
i hope this helpful for you
Judging from other answers it seems the solution can vary depending on your system. This is how I fixed the problem on Mac 10.12.
My composer executable in /usr/local/bin/composer had a different group than ~/.composer/ config and cache files.
/usr/local/bin/composer myusr admin
~/.composer/ myusr staff
The primary group for myusr is staff so I changed the group for /usr/local/bin/composer to staff.
/usr/local/bin myusr$ chgrp staff composer
Cache files that had been created when running composer as sudo in the past were still causing problems so I deleted those. Composer cache files are located here: ~/.composer/cache/
If updating hangs during composer update for a project check/empty cache files in the .composer directory for the project.

Paypal core SDK without Composer

I'm trying to get the PHP Core SDK to work without composer. There doesn't seem to be a simple way of working with the SDK without composer (https://github.com/paypal/sdk-core-php)
Any chance someone has an autoloader script or another solution to get this working?
I've been scanning for other information throughout the web, but it seems i'm the only person alive trying to get this to work without Composer.
Any chance? Thanks!
Alright, so it seems that i am really the only person on this planet who wants to do this. Well, then i'll answer my question myself. It seems like this is the guide for running every composer package without composer. Yihaa \o/. Probably easy stuff for most people using composer, but i've never used it because i'm on a shitty windows shared-host.
This is based on debian, but replace every apt-get with YUM for redhat or whatever.
So, i'm doing this in my root directory, don't whine about it :)
Ssh into your Linux Box (local mac or windows will work aswell but i'm not telling you)
# cd into the root directory (or user directory)
cd ~/
# install php5 and php5-curl and unzip (because the package we're
# getting is from GitHub). There might be other stuff your package is asking for.
# So just include it at the end
apt-get install php-5 php5-curl unzip
# install composer
curl -sS https://getcomposer.org/installer | php
# get the master archive
wget https://github.com/paypal/sdk-core-php/archive/master.zip
# unzip it
unzip master.zip
# cd into the directory
cd master
# move the files back to the ~/ directory
mv * ..
# remove the master directory
rm -r master
# install package using composer
php composer.phar install
# now we have the lib directory and the vendor directory. Lets tar that up
tar -cf package.tar lib/ vendor/
#we now have a tar file called package.tar copy that to your computer, ftp, whatever.
You can now create a directory in the place where you include all your stuff called lib-package (or whatever fancy name you'd like to call it) and add the following line in your project
require_once(/path/to/your/package/lib-package/vendor/autoload.php)
Voila, you're done.

How to install php-gtk in the Acer Aspire One?

I have an application that works pretty well in Ubuntu, Windows and the Xandros that come with the Asus EeePC.
Now we are moving to the Acer Aspire One but I'm having a lot of trouble making php-gtk to compile under the Fedora-like (Linpus Linux Lite) Linux that come with it.
I managed to get all components needed for Phoronix test suite installed on Fedora but still have one issue.
# phoronix-test-suite gui
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
/usr/bin/phoronix-test-suite: line 28: [: /usr/share/phoronix-test-suite: unary operator expected
You need two packages that aren't in Fedora, php-gtk, but php-gtk also has it's dependency - pecl-cairo
php-gtk needs to be downloaded from svn because tar.gz version is really old and doesn't work with php 5.3
Here is how I got all components built.
su -c "yum install php-cli php-devel make gcc gtk2-devel svn"
svn co http://svn.php.net/repository/pecl/cairo/trunk pecl-cairo
cd pecl-cairo/
phpize
./configure
make
su -c "make install"
cd ..
svn co http://svn.php.net/repository/gtk/php-gtk/trunk php-gtk
cd php-gtk
./buildconf
./configure
make
su -c "make install"
cd ..
wget http://www.phoronix-test-suite.com/download.php?file=phoronix-test-suite-2.8.1
tar xvzf phoronix-test-suite-2.8.1.tar.gz
cd phoronix-test-suite
su -c "./install-sh"
So please take where I left to get Phoronix test suite running on Fedora.
Hi Guys well I finally got this thing to work the basic workflow was this:
#!/bin/bash
sudo yum install yum-utils
#We don't want to update the main gtk2 by mistake so we download them
#manually and install with no-deps[1](and forced because gtk version
#version of AA1 and the gtk2-devel aren't compatible).
sudo yumdownloader --disablerepo=updates gtk2-devel glib2-devel
sudo rpm --force --nodeps -i gtk2*rpm glib2*rpm
#We install the rest of the libraries needed.
sudo yum --disablerepo=updates install atk-devel pango-devel libglade2-devel
sudo yum install php-cli php-devel make gcc
#We Download and compile php-gtk
wget http://gtk.php.net/do_download.php?download_file=php-gtk-2.0.1.tar.gz
tar -xvzf php-gtk-2.0.1.tar.gz
cd php-gtk-2.0.1
./buildconf
./configure
make
sudo make install
If you want to add more libraries like gtk-extra please type ./configure -help before making it to see the different options available.
After installing you'll need to add php_gtk2.so to the Dynamic Extensions of /etc/php.ini
extension=php_gtk2.so
Sources:
[1]: Dependency problems on Acer Aspire One Linux
If you could give us more to go on than just trouble making it compile; we might be better able to help you with your issues.

Categories