Unable to determine why composer install is failing - composer-php

I'm unable to determine why composer is failing in this ci build. It simply fails the build with no indication as to what the problem was. I've looked into -v to increase the verbosity and that has the same output at the end.
What should I try to debug this?

Composer will fail if its reaches a memory limit.
This seems to be a current trouble being discussed by the composer contributors...
You can find some issues about it on GitHub.
To face this problem, you have different solutions to try :
docker exec -it $(docker-compose ps -q sh -c cli) composer install --no-interaction --prefer-dist
If it doesn't seem to come from docker, try to see if your PHP configuration is fine :
Ensure PHP's xdebug extension is disabled for the PHP command-line version
Check if your composer.lock file is commited (it should!)
run composer with options -vvv --profile to know a bit more about the problem
As recommended by some composer contributors, get started with PHP-HHVM
If any of this is not enough, and you cannot fix it even knowing what is the memory-leak cause with -vvv option, well then maybe check either your PHP's memory_limit option or system RAM option, if it is possible for you (but it is still kind of a non-solution in my opinion) :
Maybe extend the system's memory allowed (swap file or alternatives)
Maybe install more RAM memory on the machine (worst solution in my opinion)

Related

how can i install heroku in my kali linux operating system?

I cant install heroku in my kali linux operating system. how can i resolve this issue?
isn't it not possible to run heroku in kali linux?
when I have try to install, it show snap command not found.
Heroku no longer supports Snap installs:
Snap installs are no longer supported. Please use another install method below.
Since Kali is derived from Debian, you should be able to use the Debian / Ubuntu method (which doesn't auto-update) or the standalone tarball method (which does). You can also use the NPM / Yarn package if you prefer, though Heroku recommends against it.
All of these options require some amount of trust in Heroku. The first two pull a script down from the Internet and pipe it into sh, which always makes me a bit uneasy. I suspect they both request elevated privileges during the install process. Instead of piping the file directly in to sh as Heroku recommends, I suggest you download it and at least give it a quick read through the first time.
In any case, here is the command that Heroku recommends to install the standalone version:
curl https://cli-assets.heroku.com/install.sh | sh

Laravel: Getting Started - Docker image failing to build

I'm trying to dive into Laravel for the first time, but can't seem to just get it started. I'm in a Linux environment and following the instructions on the Laravel site: https://laravel.com/docs/8.x/installation
curl -s https://laravel.build/stupidApp | bash
"Thank you! We hope you build something incredible. Dive in with: cd stupidApp && ./vendor/bin/sail up"
So far so good.
cd stupidApp && ./vendor/bin/sail up
"ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.meilisearch: 'platform'"
sudo yum update docker-compose
"No packages marked for update"
Alright, let's back up and do this without meilisearch. Let's just strip it down to MySQL.
rm -R stupidApp
curl -s "https://laravel.build/stupidApp?with=mysql" | bash
Seems to work. Carrying on....
cd stupidApp && ./vendor/bin/sail up
"W: GPG error: http://security.ubuntu.com/ubuntu hirsute-security InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security InRelease' is not signed."
Now, at this point, as far as I can tell, Laravel's own Dockerfile is failing to build the image.
vim ./vendor/bin/sail
The script checks that docker-compose is installed, checks the OS type (Linux), sources the environmental variables from .env, makes some new variables out of those ones, then basically checks to see if you passed a variable other than "up". If not, it just runs "docker-compose up", and the context of that is the docker-compose.yml file found at the root of the project. Inspecting that file.....
vim docker-compose.yml
We can see that it's attempting to build the Dockerfile found at ./vendor/laravel/sail/runtimes/8.1 So, I try building that directly.....
cd vendor/laravel/sail/runtimes/8.1
docker build .
"W: GPG error: http://security.ubuntu.com/ubuntu hirsute-security InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security InRelease' is not signed."
...and get the exact same error. Naturally, the first line of the Dockerfile defines the base image "FROM ubuntu:21.04" So, I try changing this to some other common versions of Ubuntu, and I get different errors. At this point, the errors seem irrelevant, because this is a Dockerfile published by Laravel and it should just work.
Am I doing something wrong?
My understanding of containers and building images tells me that if this isn't working for me, then it isn't working for anyone. This would lead me to believe that this isn't actually the entry point for learning Laravel. (Is anyone actually doing it this way?)
Where are people actually going to use and learn Laravel? Where is Laravel actually happening?
This might be a longshot but I had a similar error that was solved by first running docker system prune.

enable ldap module in laravel homestead

Currently have an issue where i can not enable the ldap module in homestead. I have changed multiple php.ini files and still nothing seems to be working. Has anyone else had issues with enabling modules in homestead?
Side note: when trying to restart php-fpm i am getting a permission denied issue. They prompt me with a password (which i have tried "secret") but still cant seem to get that to work either.
Have restarted the homestead instance multiple times as well. no prevail.
any thoughts?
Citti
I think this question deserves its own answer as it's pretty easy to install the wrong version of ldap on homestead and not know why things aren't working.
TL;DR: Match the version of ldap to the version of php you're running & install with apt-get.
For example, running homestead v.6.1.0:
cd HOMESTEADFOLDER # on your host
vagrant ssh # access the guest machine
sudo apt-get update # update apt-get package list
sudo apt-get install php7.1-ldap # or whatever version
In my example above, if you switch out php7.1-ldap for php7.0-ldap everything appears to install correctly (it does in fact install correctly) but, in reality, you've installed the module to a version of php that's not actually running. It took me several attempts at rebooting FPM to figure out this is what I had done.
Side note: apt-get will restart php and reload modules so there's no need to try and reboot the server or mess about with .ini files.
While ssh-ed in to the guest machine, you can check that the package is installed with php -m
If ldap is a thing your project needs, it's probably a better idea to handle this in a script. The answer referenced by fh-jashmore in his comment above comment has a simple but solid example: How to automatically enable php extensions in Homestead on vagrant up

Composer Error while installing Laravel "Failed to decode response: zlib_decode(): data error"

I've already installed laravel a lot of times, but today when I had to install it for my project I experienced the following strange error:
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode
I ran the following command to install laravel:
composer create-project laravel/laravel myproject --prefer-dist
in my /var/www/ directory which is totally read, write and executable.
Try the following command:
composer clear-cache
Add this lines to " composer.json " before the last line that conten this symbol " } "
,
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Now cd to your project folder and type :
Composer install
Credits to:
http://www.webdeveloper.com/forum/showthread.php?285403-Need-Help-Installing-Laravel
Short: Run composer self-update --update-keys and follow instructions.
Step by step:
I had the same error when trying to install dependencies for my project:
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Your configuration does not allow connection to http://packagist.org. See https://getcomposer.org/doc/06-config.md#secure-http for details.
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Just to be sure, I tried to update the composer with composer self-update, which gave me the same error, but another hint:
[RuntimeException]
The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified
The issues is solved by running
composer self-update --update-keys
and entering the keys from Composer Public Keys / Signatures page. I was able to download my dependencies afterwards.
In my case, the version of VirtualBox was the issue.
https://github.com/composer/composer/issues/5814
Make sure that your VB is not 5.0.28 or 5.1.8.
Following what #dwainm says, you can also define this configuration globally to avoid editing the composer.json from your project.
Create a ~/.composer/config.json with:
{
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{
"packagist": false
}
]
}
install or update the library after running
composer config --global repositories.packagist.allow_ssl_downgrade false
If you look at the answers people come up with this, there are a wide variety of things that fixed it for various people, including using "sudo", using "self-update", etc etc.
After a lot of testing, I found that the real answer is to just keep on running it over and over again. It gets a little farther each time, and caches the previous data that it was able to get the last time. So eventually it just works, and then people think that the last thing they did is what solved it. In reality you just have to run it over and over. This is clearly something that composer should fix.
The key to seeing that it is making progress each time you run it is to use
composer update -vvv
That will show you how far it got with the last time you ran it. Each time you run it, it will usually download another repo or two.
Until composer fixes whatever the underlying cause is, that appears to be the best solution. Good luck.
Quick fix from composer
Degraded Mode#
Due to some intermittent issues on Travis and other systems, we introduced a degraded network mode which helps Composer finish successfully but disables a few optimizations. This is enabled automatically when an issue is first detected. If you see this issue sporadically you probably don't have to worry (a slow or overloaded network can also cause those time outs), but if it appears repeatedly you might want to look at the options below to identify and resolve it.
If you have been pointed to this page, you want to check a few things:
If you are using ESET antivirus, go in "Advanced Settings" and disable "HTTP-scanner" under "web access protection"
If you are using IPv6, try disabling it. If that solves your issues, get in touch with your ISP or server host, the problem is not at the Packagist level but in the routing rules between you and Packagist (i.e. the internet at large). The best way to get these fixed is raise awareness to the network engineers that have the power to fix it.
To disable IPv6 on Linux, try using this command which appends a rule preferring IPv4 over IPv6 to your config:
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
If none of the above helped, please report the error.
I'll leave this answer to those like me have tried all of the above solutions do not succeed. In my case the problem was related version of Virtual Box (1.5.8) for Mac. I did downgrade my previous version (1.5.2) and all returned to work properly.
This may seem redundant, but try restarting your machine. If you've just installed composer and other things, then your system may just need to be refreshed..
I was having this same issue, but it is now working correctly after a restart (on Mac).
There are many answers to this question because there are a variety of factors that could be causing this issue. It basically comes down to 1) a caching issue, 2) a connection issue to your repository (e.g. Packagist), or 3) a config issue with your Composer project.
Before you reconfigure your entire setup, eliminate options 1 and 2 first. For example, on May 23, 2017 Packagist was having issues, so switching to a different mirror solved the issue for me.
in Linux i used sudo before 'composer update' and problem solved.
sudo composer update
composer clear-cache
sudo composer self-update
Use the command composer clear-cache to clear composer cache. Also, make sure you have access to your .composer directory. It is usually located in ~/.composer.
Check that you have ZIP extension installed for your PHP CLI
for me helped(ubuntu): sudo apt-get install php7.0-zip
here is the correct way of installation of composer for slim.
1.start the composer installer (composerSetup.exe)
note: if no php.exe file is selected by default, then go to the folder of your installation (wamp, xamp, lamp -your choice of installation) folder and under bin folder, look for php\php.exe - which happens to be your command-line php for slim.
2.start the wamp, xamp or lamp (of your choice) server (to avoid the error "failed to decode zlib stream" )
3. then proceed with the rest of the installation(which will eventually lead to completion of installation with no user input required further).
I ran in the same issue while trying to composer install doctrine/dbal
This message kept showing: Failed to decode response: zlib_decode(): data error
I had to update my composer.json by adding the following lines:
{
...
"config": {
"http": true
}
...
}
And it fixed the problem. I hope it will help some of you.
For me, this error disappears when I switch off my VPN (ExpressVPN). The other methods suggested here did not work.
In my case, the issue was caused by bad file permissions in my ~/.composer directory.
So I ran
sudo chown myusername:myusername ~/.composer
(replacing myusername with my actual user name)
Then composer ran fine.
in window i used this cmd
php composer.phar clear-cache
Workaround Mac OS X:
Get name of your network device:
networksetup -listallnetworkservices
Disable IPv6 on that device (in this case "Wi-Fi"):
networksetup -setv6off Wi-Fi
Run composer ...
You can enable IPv6 again with:
networksetup -setv6automatic Wi-Fi
From Composer documentation:
Due to some intermittent issues on Travis and other systems, we
introduced a degraded network mode which helps Composer finish
successfully but disables a few optimizations. This is enabled
automatically when an issue is first detected. If you see this issue
sporadically you probably don't have to worry (a slow or overloaded
network can also cause those time outs), but if it appears repeatedly
you might want to look at the options below to identify and resolve
it.
If you are using IPv6, try disabling it. If that solves your issues,
get in touch with your ISP or server host, the problem is not at the
Packagist level but in the routing rules between you and Packagist
(i.e. the internet at large). The best way to get these fixed is raise
awareness to the network engineers that have the power to fix it. Take
a look at the next section for IPv6 workarounds.
SOLUTION FOR LINUX:
To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following lines at the end:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
I have been facing a similar problem. Writing the given lines in your composer.json files and then run composer update following the next composer command. Hope it helps someone as it does to me.
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
For Windows 10
According to TroubleShooting Composer as stated by other answers also for other OS, this may happen due to ipv6. If we disable it for all tunnels, it gets solved in Windows 10.
To disable ipv6 in Windows:
Download EasyFix file from Microsoft Support and follow the steps as stated there:
Click the Download button for the procedure that you want to run.
Click Run or Open in the File Download dialog box.
Follow the steps in the easy fix wizard.
Note: I downloaded Disable IPv6 on all tunnel interfacesversion and ran it. Then I could use composer create-project command.
Try composer clear-cache and then turn off your windows firewall
For linux ubuntu 20.04
try these step by step:
0-go to home by command "**cd ~**"
1-**composer clear-cache**
2-remove old version of composer (1.x.x) if exists "**sudo rm -R ~/.config/composer**"
3-change your internet connection(cable or wifi or ...)(important)
4-install new version with these commands...
4-1: **sudo apt update**
4-2: **sudo apt install php-cli unzip**
4-3: **sudo apt install curl**
4-4: **cd ~**
4-5: **curl -sS https://getcomposer.org/installer -o composer-setup.php**
4-6: **HASH=`curl -sS https://composer.github.io/installer.sig`**
4-7: **php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"**
4-8: **sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer**
4-9: check composer version with "**composer --version**"
if return composer 1.x.x, check this:
php /usr/local/bin/composer
if return 2.x.x, you must find your composer that installed locally and delete its folder.
Do Not Remove this folder /usr/local/bin/composer
For myself, I just made
sudo apt-get upgrade composer

Composer executes without any output

I'm running composer on Mac OS Yosemite. It worked well but suddenly I got no output at all (including any error).
For an example, when I run:
composer --version
terminal executes that without any output. No error as well. It happens with all composer command options. I did Google search but without relevant results.
Any idea?
Found a reason. Timezone must be set in php.in (date.timezone = UTC). I'm not sure what update caused composer to stop working, but that has solved a problem).

Resources