zlib_decode(): data error using composer in the doctrine2 tutorial - php

UPDATE:
I posted this issue to the bug tracker a while ago as suggested in comments, and now I ran a clean installation of the new version of composer (Composer version 7131607ad1d251c790ce566119d647e008972aa5 2014-05-27 14:26:24) and the issue is fixed.
ORIGINAL POST:
I'm trying to learn how to use doctrine2 using their tutorial at http://docs.doctrine-project.org/en/latest/tutorials/getting-started.html
but for some reason I get this error when trying to run composer install:
[ErrorException]
zlib_decode(): data error
Here is the contents of composer.json:
{
"require": {
"doctrine/orm": "2.4.*",
"symfony/yaml": "2.*"
},
"autoload": {
"psr-0": {"": "src/"}
}
}
EDIT: PHP Version 5.5.9.
EDIT: output of composer install -vvv:
Reading ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Executing command (CWD): svn info --xml
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache
Installing dependencies (including require-dev)
Downloading https://packagist.org/p/provider-active$1874cad4a77f2dbd91c33e813330434e6c38cd940846c58a610595dac158d161.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/p-provider-active.json into cache
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
[ErrorException]
zlib_decode(): data error
Exception trace:
() at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem.php:217
Composer\Util\ErrorHandler::handle() at n/a:n/a
zlib_decode() at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem
.php:217
Composer\Util\RemoteFilesystem->get() at phar://C:/composer/composer/src/Compos
er/Util/RemoteFilesystem.php:82
Composer\Util\RemoteFilesystem->getContents() at phar://C:/composer/composer/sr
c/Composer/Repository/ComposerRepository.php:612
Composer\Repository\ComposerRepository->fetchFile() at phar://C:/composer/compo
ser/src/Composer/Repository/ComposerRepository.php:519
Composer\Repository\ComposerRepository->loadProviderListings() at phar://C:/com
poser/composer/src/Composer/Repository/ComposerRepository.php:271
Composer\Repository\ComposerRepository->whatProvides() at phar://C:/composer/co
mposer/src/Composer/DependencyResolver/Pool.php:254
Composer\DependencyResolver\Pool->computeWhatProvides() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Pool.php:243
Composer\DependencyResolver\Pool->whatProvides() at phar://C:/composer/composer
/src/Composer/DependencyResolver/Solver.php:149
Composer\DependencyResolver\Solver->setupInstalledMap() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Solver.php:163
Composer\DependencyResolver\Solver->solve() at phar://C:/composer/composer/src/
Composer/Installer.php:467
Composer\Installer->doInstall() at phar://C:/composer/composer/src/Composer/Ins
taller.php:215
Composer\Installer->run() at phar://C:/composer/composer/src/Composer/Command/I
nstallCommand.php:122
Composer\Command\InstallCommand->execute() at phar://C:/composer/composer/vendo
r/symfony/console/Symfony/Component/Console/Command/Command.php:241
Symfony\Component\Console\Command\Command->run() at phar://C:/composer/composer
/vendor/symfony/console/Symfony/Component/Console/Application.php:892
Symfony\Component\Console\Application->doRunCommand() at phar://C:/composer/com
poser/vendor/symfony/console/Symfony/Component/Console/Application.php:191
Symfony\Component\Console\Application->doRun() at phar://C:/composer/composer/s
rc/Composer/Console/Application.php:117
Composer\Console\Application->doRun() at phar://C:/composer/composer/vendor/sym
fony/console/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at phar://C:/composer/composer/src
/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar://C:/composer/composer/bin/composer
:43
require() at C:\composer\composer:15
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver
bose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

During the last day I've spend a lot of time trying to deal with zlib_decode(): data error problem and it definitely is not related to what exact package you are trying to install. It has to do something with proxy and/or bad internet connection. Disabling antivirus did not help my case as I'm not using antivirus on my Mac. These are the things that did help in the end.
1. Force HTTPS for package retrieval by adding this to your composer.json.
{
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{"packagist": false}
],
"require": { /* your packages as usual */ }
}
2. If you still experience the problem, try to run composer diag. In my case few of the messages there were:
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
After doing composer self-update --update-keys and following the instructions - on the next attempt, all worked fine.

In my case it was Avast antivirus. After disabling everything updated without problems.

Just install unzip on your machine, if you are using debian/ubuntu:
sudo apt-get install unzip
That works for me!

Related

\[InvalidArgumentException\] Could not find package vlucas/phpdotenv. Couldn't download package

I'm having a problem with vlucas/phpdotenv installation
 ~/ nslookup repo.packagist.org
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: repo.packagist.org
Address: 54.37.2.184
My composer.json:
{
"name": "developer/mvc",
"authors": [
{
"name": "Abubakr Abduvakhidov",
"email": "abubakr#edu.thedevs.co"
}
],
"autoload": {
"psr-4": {
"app\\": "."
}
},
"require": {}
}
Output of composer diagnose:
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0.8
PHP version: 7.4.12
PHP binary path: /usr/local/Cellar/php/7.4.12/bin/php
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip: extension present, unzip present
When I run this command:
composer require vlucas/phpdotenv -vvv
I get the following output:
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 2.0.8 (2020-12-03 17:20:38) with PHP 7.4.12 on Darwin / 20.1.0
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading ./composer.json
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Loading config file ./composer.json
Checked CA file /usr/local/etc/openssl#1.1/cert.pem: valid
Executing command (/Users/abubakr): git branch -a --no-color --no-abbrev -v
Executing command (/Users/abubakr): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/Users/abubakr): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/Users/abubakr): hg branch
Executing command (/Users/abubakr): fossil branch list
Executing command (/Users/abubakr): fossil tag list
Executing command (/Users/abubakr): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Downloading https://packagist.phpcomposer.com/packages.json
[200] https://packagist.phpcomposer.com/packages.json
Writing /Users/abubakr/.composer/cache/repo/https---packagist.phpcomposer.com/packages.json into cache
Downloading https://packagist.phpcomposer.com/p2/vlucas/phpdotenv.json
[404] https://packagist.phpcomposer.com/p2/vlucas/phpdotenv.json
Downloading https://packagist.phpcomposer.com/p2/vlucas/phpdotenv~dev.json
[404] https://packagist.phpcomposer.com/p2/vlucas/phpdotenv~dev.json
Downloading https://packagist.org/search.json?q=vlucas/phpdotenv&type=
[200] https://packagist.org/search.json?q=vlucas/phpdotenv&type=
[RuntimeException]
No composer.json present in the current directory, this may be the cause of
the following exception.
Exception trace:
() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/RequireCommand.php:193
Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:310
Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:122
Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/bin/composer:63
require() at /usr/local/Cellar/composer/2.0.6/bin/composer:24
[InvalidArgumentException]
Could not find package vlucas/phpdotenv.
Did you mean one of these?
vlucas/phpdotenv
sobyte/dotenv-php
calgamo/module-php-dotenv
abacaphiliac/zend-phpdotenv
davek1312/config
Exception trace:
() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/InitCommand.php:796
Composer\Command\InitCommand->findBestVersionAndNameForPackage() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/InitCommand.php:430
Composer\Command\InitCommand->determineRequirements() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/RequireCommand.php:189
Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:310
Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:122
Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/bin/composer:63
require() at /usr/local/Cellar/composer/2.0.6/bin/composer:24
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
And I expected this to happen:
package to be installed
Additional:
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] which composer
/usr/local/bin/composer
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] alias | grep composer
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] ls
composer.json core models vendor
composer.lock migrations public views
controllers migrations.php runtime
Actually, it was because of loading metadata from https://packagist.phpcomposer.com/packages.json, which is not the official Packagist, but an official mirror (and a broken one according to the list in https://github.com/Webysther/packagist-mirror#-packagist-public-metadata-mirrors-observatory-around-the-world)
That's probably the reason for the issue: the package is not found in the metadata in this repository, but the repository still exposes the official search endpoint instead of a mirrored one, which is used by composer when looking for alternative names.
After running the command in the bottom it started downloading
composer config -g repo.packagist composer https://packagist.org

Different Package Version for Development & Production in Composer

i am working on multiple composer packages and a application which dose requries all the packages that i develop.
I would like to know how i can have a package with multiple version
stable version for production
development / master version for local development
i tried following config but it din't work
{
"minimum-stability" : "dev",
"require" : {
"varunsridharan/vsp-framework" : "^1.0",
"wponion/wponion" : "^1.0"
},
"require-dev" : {
"varunsridharan/vsp-framework" : "dev-master",
"wponion/wponion" : "dev-development"
}
}
When i run composer install or composer install --no-dev i get the below output
Loading composer repositories with package information
Updating dependencies
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
- The requested package varunsridharan/vsp-framework ^1.0 exists as varunsridharan/vsp-framework[dev-master] but these are rejected by your constraint.
Problem 2
- The requested package wponion/wponion ^1.0 exists as wponion/wponion[dev-development] but these are rejected by your constraint.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-author
itative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
Reason why composer has require and require-dev is to allow developers install packages that will allow them better debugging by using packages that are not suggested to be used in production. By adding a package on require-dev this package will not be required on production.
Ex. If you want to optimize you queries, see if you have any n+1 query problem etc you might want to install php-debugbar that will show you this info, but having this on production might expose your queries and will give sensitive info to bad guys.
Packages included on require will always be installed in development and in production and this is the reason you see the error The requested package xxxxx exists as xxxxx[dev-development] but these are rejected by your constraint.
To have different packages in DEV and PROD you need different composer.json files for each environment like #George said.
You can have one composer.json file that will be the production composer and one composer-dev.json that you can use for development.
On your local environment you will need to set value of COMPOSER env variable to composer-dev.json.
Simple way to do this is by running composer like this: COMPOSER=composer-other.json php composer.phar install
If you want to require a new packages you need to run the command twice, one time normally and one time by adding COMPOSER=composer-other.json before composer, to ensure that the package will be added both in dev and production.
P.S I do not know the reason why you need different packages for development and production, but it is suggested to have the same version of packages in dev and prod as having different versions might bring up bugs
You can try changing composer.json file in your dev environment. See Composer
COMPOSER=composer-dev.json php composer install
Reference Composer - specify `composer.json` path

How to correct the [Composer\Downloader\TransportException] error for composer

Good day people, I have been having this problem for days now, when I try to download dependencies for my php project using composer I get this error
c:\wamp64\www\Test>composer global require "fxp/composer-asset-plugin:^1.3.1"
Changed current directory to C:/Users/Nwachukwu Favour/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, reverting ./composer.json to its original content.
[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2014%241cf88bd0ed4076dc091407477ba2a76483e8598ee5365673381262e6c1d40fcf.jso
n" file could not be downloaded: failed to open stream: HTTP request failed!
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
I am running a windows 10 OS and am suspecting that my system cannot download from the command line. I would be very glad if someone can help me solve this problem because it is hindering my project. Thanks in advance.
You could also run this command on the CLI before installing any dependencies. It forces composer to use https to download all resources:
composer config -g repo.packagist composer https://packagist.org
The issue could be caused by the redirect from http to https. (or your firewall blocking the call)
According to this article the problem could be solved by adding the following to your composer.json:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Forcing composer to use https connections to Packagist
I just updated my composer to the latest version and this problem is solved.
Try
composer self-update
To know the current version and update details:
composer diagnose
I tried the command below and it worked.
composer config -g repo.packagist composer https://packagist.org
This is just one of the options given above.
I found enabling OpenSSL extension in the php.ini-development/production file fixed the problem.
Its located within your PHP install
just stop your antivirus software :)
for some reason antivirus software kaspersky doesn't like composer :(
I had the same error tried everything... nothing worked.
I remembered I had issues with composer in the past while my AV was on... turned it off and composer worked like a charm :)
just put this in command
composer config -g repo.packagist composer https://packagist.org
Update or Delete your 'http_proxy' variable.
Delete composer
Install Composer again
Restart your machine.
Your are good to go.
try with composer diagnose and after that composer update -vvv
I had the same error, but it was resolved in a different way for me. I used to give sudo to composer commands because folder /home/aspire/.composer is in sudo permission. I changed it to sudo chown $USER /home/aspire/.composer.
I changed the permissions as I mentioned and I ran the code
sudo composer require symfony/orm-pack
Throws error
[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded:
Then I tried
composer require symfony/orm-pack
It works
If anyone know the exact reason, please comment
if you are in china like me,try this:https://developer.aliyun.com/composer
github connection not stable recently.I tryed https://pkg.phpcomposer.com/ first but don't work. I tryed composer diag and composer -vvv and wait.out put show cache file is :Writing C:/Users/Administrator.000/AppData/Local/Composer/repo.so i copy cache file from my colleague,and it works first,laravel run,but composer require show 404.then i found the solution above.try composer update -lock and change the repositories url to ali's.And solved.
This problem happened to me, and I solved it by turning off the firewall.
This is one of the solutions.
If you have http_proxy environment variable, just delete it from either User variables or System variable and save yourself from all this trouble.

Laravel 4: Fatal error: Class 'Patchwork\Utf8\Bootup' not found in autoload.php

I added "cviebrock/image-validator": "1.0.*" to require section of composer.json. After, I ran composer update, I am getting this Fatal error.
:::ERROR:::
Fatal error: Class 'Patchwork\Utf8\Bootup' not found in F:\xampp\htdocs\project\
bootstrap\autoload.php on line 46
Script php artisan clear-compiled handling the post-update-cmd event returned wi
th an error
[RuntimeException]
Error Output:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]
[--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-
dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [
packagesN]
:::END of ERROR:::
:::COMPOSER.JSON Require section:::
"require": {
"intervention/image": "2.*",
"cviebrock/image-validator": "1.0.*"
},
I need help in rectifying this fatal error.
Thanks & Regards,
Michael Sangma
This error seems to me like there is no patchwork/utf8 package installed.
See in your vendor folder whether the package exists or add in the require section in your composer.json file: "patchwork/utf8": "1.1.*" and then do composer update.
I was having the same problem because when I run
php artisan db:seed --class=PostsTableSeeder
it started to remove laravel, symfony etc. I can't understand why?(may be my composer.json included at that time only "require": {
"fzaninotto/faker": "1.3.*#dev"
},)
So what I did, I updated my composer.json again and run composer update --dev. composer.json as
"require": {
"laravel/framework": "4.2.*",
"way/generators": "~2.0",
"patchwork/utf8": "1.1.*",
"fzaninotto/faker": "1.3.*#dev"
},
And that worked because it downloaded again everything.
I just commented the 'Patchwork\Utf8\Utf8ServiceProvider' in app.php and it worked
I Solved It With composer dump-autoload and then composer update
After that it works
But if you encounter more issue try to
Delete the vendor folder or just rename it fo backup puporse incase it fails like mv vendor ve then
Delete composer.lock
Run the command composer clearcache (or clear-cache)
Run composer install
Your good to go.
Dude, you just have to do this:
composer require patchwork/utf8
I am most certain you pulled your application from a git? If you take a closer look at your .gitignore file you would see that /vendor is one of the files/folders that git was told to ignore. You need to remove /vendor, composer.lock and composer.phar from .gitignore IF you're in development.
Also if you navigate to the /vendors folder via FTP or ssh, you will see that it only has folders that were outlined in your composer.json file under
"require": {
}
are the ones in the vendor folder.
Once you run composer update and composer install you should be fine.

My composer won't update completely with Laravel 4 it gets stuck with artisan

Here is the error I am getting:
Script php artisan optimize handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
This shows after:
Writing lock file
Generating autoload files
I tried to delete all my folders in my vendor folder. But that did not change anything.
I am using MAMP server on my Mac OS X.
PHP Version 5.4.10
mcrypt 2.5.8
I just tried "sudo composer update --verbose" and I got this error:
sudo composer update --verbose
Password:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
Script php artisan optimize handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
Exception trace:
() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:148
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:107
Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///usr/bin/composer/src/Composer/Installer.php:289
Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/UpdateCommand.php:118
Composer\Command\UpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:897
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:117
Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:43
require() at /usr/bin/composer:15
Here is the error I found in my PHP error logs:
[04-Nov-2013 20:45:44 Europe/Berlin] PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in /Applications/MAMP/htdocs/-----/bootstrap/autoload.php on line 46
I just tried to test my composer:
sudo composer diagnose
Password:
Checking platform settings: OK
Checking http connectivity: OK
Checking composer.json: FAIL
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Name "andrew13/Laravel-4-Bootstrap-Starter-Site" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "andrew13/laravel-4-bootstrap-starter-site" instead. As such you will not be able to submit it to Packagist.
Checking disk free space: OK
Checking composer version: OK
Just applied the recommendation in the error message from the last command. Now everything is showing as OK.
I just tried this:
curl -sS https://getcomposer.org/installer | php -- --check
#!/usr/bin/env php
All settings correct for using Composer
I am now getting new errors in my PHP Error logs:
[05-Nov-2013 05:45:45 Europe/Berlin] PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class config does not exist' in /Applications/MAMP/htdocs/---/bootstrap/compiled.php:165
Stack trace:
#0 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(165): ReflectionClass->__construct('config')
#1 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(142): Illuminate\Container\Container->build('config', Array)
#2 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(444): Illuminate\Container\Container->make('config', Array)
#3 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(233): Illuminate\Foundation\Application->make('config')
#4 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(3151): Illuminate\Container\Container->offsetGet('config')
#5 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(103): Illuminate\Exception\ExceptionServiceProvider->Illuminate\Exception\{closure}(Object(Illuminate\Foundation\Application))
#6 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(163): Illuminate\Container\Container->Illum in /Applications/MAMP/htdocs/---/bootstrap/compiled.php on line 165
I believe this error results from not being able to find mcrypt.
Script php artisan optimize handling the post-update-cmd event returned with an error
Apparently it is not quite that easy to install mcrypt.
Install the php5-mcrypt package, or verify that it has been installed correctly.
sudo apt-get install php5-mcrypt
Check whether mcrypt has been installed and enabled for PHP:
php --ri mcrypt
You're done if it says:
mcrypt support => enabled
Otherwise, continue if it says:
Extension 'mcrypt' not present.
Verify that mcrypt.ini is present in PHP's mods-available directory.
ls /etc/php5/mods-available/mcrypt.ini
If it says No such file or directory, create a symbolic link from mcrypt.ini to PHP's mods-available directory.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
Enable the mod.
sudo php5enmod mcrypt
Restart apache.
sudo service apache2 restart
Check again whether mcrypt is enabled.
php --ri mcrypt
The final steps were inspired by Vuk Stanković.
Okay, did some further research with Google and it seems that this has to do with the autoload caching from Composer. There are various ways on how you can solve this.
composer dump-autoload
This would re-create the autoload stuff for you and it should solve your problem for now.
If this doesn't help, try deleting everything and re-install fresh: [ref]
rm -rf /path/to/composer.lock /path/to/vendor/
composer install
This would re-create just about everything.
It looks like your laravel install did not run correctly and since part of the composer.json runs the php artisan clear-compiled and php artisan optimize if your laravel application is not working then composer will fail.
Try running your composer update without invoking the Laravel scripts.
php composer update --no-scripts
After that you can either run the commands from the scripts block in your composer.json manually. Else you can just run a standard
php composer update
again which will run the scripts for you.
To fix this you need to install mcrypt.
In ubuntu execute the following command:
sudo apt-get install php5-mcrypt
Then update composer:
composer update
Another solution for me, setting xdebug.scream = 1 gives problem:
1) Find xdebug configuration file.
$ sudo find / -name xdebug.ini
2) Edit file using any text editor.
$ sudo vi /your_path/xdebug.ini
3) Set xdebug.scream = 0
4) Reload server
$ sudo service apache2 reload
I had a similar issue when trying to run composer update and none of the solutions above had worked. It turns out I had 2 require sections in my composer.json which is actually wrong.
"require": {
"laravel/framework": "4.1.*"
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable",
"require": {
"barryvdh/laravel-ide-helper": "1.*",
"zizaco/confide": "3.2.x",
"laravelbook/ardent": "dev-master",
"zizaco/entrust": "dev-master"
},
"require-dev": {
"way/generators": "2.*",
"fzaninotto/faker": "1.3.*#dev"
}
Combining the two as below solved my issue.
"require": {
"laravel/framework": "4.1.*",
"barryvdh/laravel-ide-helper": "1.*",
"zizaco/confide": "3.2.x",
"laravelbook/ardent": "dev-master",
"zizaco/entrust": "dev-master"
},
If you still have a problem, try deleting the composer.lock and the vendor directory and run
mv ~/.composer/cache ~/.composer/cache.bak
To clear the composer cache and finally run
sudo composer install
This should solve the issue.

Categories