Composer freezing when installing symfony vendors - symfony

I'm trying to install Symfony 2. I get the same issue of I download the archive without vendors and if I try to install via curl.
Running OSX/MAMP setup.
➜ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing symfony/icu (v1.0.0)
Downloading: connection...^C
➜ composer install -vvv
Downloading composer.json
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /Users/alexlongshaw/.composer/cache/repo/https---packagist.org/packages.json into cache
Downloading https://packagist.org/p/provider-active$fa1339d67d333d9449a21f7a2c80888f2c7a02dbb4d3e6b11a9dd5855df3f537.json
....
Downloading http://packagist.org/p/symfony/class-loader$962a39a1da8588e7f97e22517580a460d5349699d5ccb967167c2a1e9802ce50.json
Reading /Users/alexlongshaw/.composer/cache/repo/https---packagist.org/provider-symfony$class-loader.json from cache
zlib_decode(): data error
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Downloading http://packagist.org/p/symfony/config$eec66e956c41b0728a7fc4f40b95a116bc469f8583c2602b14af3d00f36711fc.json
Writing /Users/alexlongshaw/.composer/cache/repo/https---packagist.org/provider-symfony$config.json into cache
Reading /Users/alexlongshaw/.composer/cache/repo/https---packagist.org/provider-phpoption$phpoption.json from cache
- Installing symfony/icu (v1.0.0)
Downloading https://api.github.com/repos/symfony/Icu/zipball/v1.0.0
Downloading: connection...
As you can see below, if I do composer update I get a similar problem.
➜ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
zlib_decode(): data error
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
- Installing symfony/icu (v1.0.0)
Downloading: connection...
Any suggestions on how to get past this? It works fine for me on an Ubuntu VM so I presume it is something to do with the setup.
Composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}

zlib extension enabled?
check your phpinfo if zlib ( which provides zlib_decode ) is enabled or run
php -m
if your php cli uses a different php.ini
cache problem?
[...] package information was loaded from the local cache and may be out of date
Delete composer's cache folder being...
/Users/alexlongshaw/.composer/cache/
... in your case to prevent updating from cache only and see if a general connection exists.
proxy?
make sure you don't have a proxy set via environment-variables
https_proxy
http_proxy
HTTPS_PROXY
HTTP_PROXY
common problems
composer has built-in capabability of identifying some common problems
composer diagnose

This turned out to be network related. Didn't work on either connection (Broadband or 3G) at home but at work there were no problems

Related

Symfony\Component\Console\Exception\LogicException during php bin/console server:run

I cannot run symfony local server by command: php bin/console server:run.
I get error:
[Symfony\Component\Console\Exception\LogicException]
An option named "connection" already exists.
Dependencies in composer.json:
"require": {
"php": "^7.0, <7.4",
"composer/package-versions-deprecated": "^1.11",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.3.10",
"symfony/symfony": "3.3.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"doctrine/data-fixtures": "^1.3",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"liip/functional-test-bundle": "^1.8",
"phpunit/phpunit": "^6.3",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
parameters.yml:
# This file is auto-generated during the composer install
parameters:
database_host: 127.0.0.1
database_port: 3306
database_name: tests
database_user: root
database_password: password
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: ThisTokenIsNotSoSecretChangeIt
I think these parameters in parameters.yml used to work earlier.
I use mysql and also sqlite for tests.
I faced the same issue in a Symfony v4.2 project, without changing anything in my code base.
As already found in this issue https://github.com/doctrine/dbal/issues/4565
it appears in certain versions of the doctrine/doctrine-bundle package (in my case v1.11). The RunSqlDoctrineCommand.php from vendor adds the second option which causes the error.
If you can update your doctrine/doctrine-bundle package, you might be fine. In my case, an update or fix by package was not possible.
What can we do in that case?
What comes next is more a hack, than a real good solution, so use it at your own risk!
As statet in the commit from official repository: https://github.com/doctrine/DoctrineBundle/commit/86d2469d6be06d55ad7b9e2f076f6942476f2e87 (thanks to the guys in issue above)
I made a copy of the new RunSqlDoctrineCommand.php from that commit and save it in my project as dist/RunSqlDoctrineCommand.php.
In composer.json change the scripts sections as follows:
{
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd"
},
"doctrine-bugfix": [
"cp -f dist/RunSqlDoctrineCommand.php vendor/doctrine/doctrine-bundle/Command/Proxy/RunSqlDoctrineCommand.php"
],
"post-install-cmd": [
"#auto-scripts",
"#doctrine-bugfix"
],
"post-update-cmd": [
"#auto-scripts",
"#doctrine-bugfix"
]
}
}
This will just copy and override the original file in vendor directory on every composer install/update. This will only work on a unix/linux system, btw.
As said: Not the best solution, but it keeps your project in shape.
In this answer is there is a good explanation
in my case
composer update doctrine/doctrine-bundle
Inside (symfony project) vendor/doctrine/doctrine-bundle/Command/Proxy/RunSqlDoctrineCommand.php change configure function like below:
protected function configure()
{
parent::configure();
$this
->setName('doctrine:query:sql')
//->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The
connection to use for this command')
->setHelp(<<<EOT
The <info>%command.name%</info> command executes the given SQL query and
outputs the results:
<info>php %command.full_name% "SELECT * FROM users"</info>
EOT
);
if ($this->getDefinition()->hasOption('connection')) {
return;
}
$this->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The
connection to use for this command');
}

Symfony 4 recipe cannot be installed on project because of dotenv issue

I've been trying to install the cache/cache-bundle recipe into my symfony4 flex-configured project, but to no avail. I execute:
composer require cache/cache-bundle
And this is what I got on the shell:
Installing the cache-bundle generates a cache.yml file under config/packages/cache.yml, and its default content is:
cache:
session:
enabled: "%env(bool:SESSION_CACHE_ENABLED)%"
service_id: "cache.provider.default"
use_tagging: true
ttl: 7200
router:
enabled: "%env(bool:ROUTER_CACHE_ENABLED)%"
service_id: "cache.provider.default"
ttl: 86400
logging:
enabled: "%env(bool:APP_DEBUG)%"
logger: "logger"
level: "info"
The problematic line is the first "enabled" one. For some reason, Symfony or composer doesn't like that %env(bool:SESSION_CACHE_ENABLED)% and returns that error message:
Invalid type for path "cache.session.enabled". Expected boolean, but
got string.
SESSION_CACHE_ENABLED is a value introduced in the .env file of the project by composer in a block like this.
###> cache/cache-bundle ###
SESSION_CACHE_ENABLED=true
ROUTER_CACHE_ENABLED=false
###< cache/cache-bundle ###
Then, the question is if someone else has "suffered" this problem and found a fix or workaround to make this config work. My objective is to use this dependency in my mock project to cache arrays in memory to use them as a fake DB system.
I thought to open an issue about this, but since I'm not sure if this is a Simfony issue or just a problem in the recipe I preferred to ask here first.
And for the sake of completion, here's the list of current dependencies already in my project.
"require": {
"php": "^7.1.3",
"easycorp/easy-log-handler": "^1.0",
"friendsofsymfony/rest-bundle": "^2.3",
"hermes/bridge/common": "dev-master",
"hermes/common": "dev-master",
"jms/serializer": "^1.10",
"jms/serializer-bundle": "^2.3",
"ramsey/uuid": "^3.7",
"sensio/framework-extra-bundle": "^5.1",
"symfony/cache": "^4.0",
"symfony/console": "^4.0",
"symfony/framework-bundle": "^4.0",
"symfony/http-foundation": "^4.0",
"symfony/monolog-bundle": "^3.1",
"symfony/stopwatch": "^4.0",
"symfony/web-server-bundle": "^4.0",
"symfony/yaml": "^4.0"
},
"require-dev": {
"symfony/flex": "^1.0",
"symfony/dotenv": "^4.0"
}
I've seen questions about issues regarding booleans in dotenv files, but nothing conclusive for this question, I'm afraid.
Have you tried to get rid off the quotes around "%env(bool:SESSION_CACHE_ENABLED)%"?

Failed to Install Data-Fixtures with Doctrine and Symfony2

I added the docrtine-fixtures and the doctrine-fixtures-bundle to my dependencies in the composer.json, as follow:
{
"require": {
"php": ">=5.3.3",
"symfony/finder": "2.3.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/data-fixtures": "~1.1",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0"
}
}
And then I did php-cli composer.phar update, which worked and displayed the right message on my terminal:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating doctrine/data-fixtures (dev-master bd44f6b => v1.1.1)
Checking out bd44f6b6e40247b6530bc8abe802e4e4d914976a
Writing lock file
Generating autoload files
Bu when I go to the folder vendor/doctrine, I cannot find any data-fixtures repository. What is the issue? Why does composer not load it and why does it display success messages?
(PS: My solution was to add the doctrine-fixture repository manually but it doesn't solve the composer issue).
It could be a Composer caching issue. Try removing Composer's cache directory:
rm -rf ~/.composer/cache

Composer error when I want to install fosuserbundle

When I use this command in cmd
php composer.phar update friendsofsymfony/user-bundle
I get this message
Please provide a version constraint for the
friendsofsymfony/user-bundle requirement: 2.0.*#dev composer.json has
been updated Loading composer repositories with package information
Updating dependencies (including require-dev) Your requirements could
not be resolved to an installable set of packages.
Problem 1
- The requested package friendsofsymfony/user-bundle could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see
https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
Read http://getcomposer.org/doc/articles/troubleshooting.md for
further common problems.
Installation failed, reverting composer.json to its original content.
I've already added "minimum-stability": "dev", in my composer.json
It's the first time that I head this problem I installed fosuserbundle manytimes and it worked before.
I just Advice you just use this to configure all the sonata admin + fos user bundle without any dependencies or version conflicts
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "~2.3#dev",
"sonata-project/doctrine-orm-admin-bundle": "~2.3#dev",
"sonata-project/core-bundle": "~2.2#dev",
"sonata-project/user-bundle": "2.2.x-dev",
"friendsofsymfony/user-bundle": "~1.3#dev",
"sonata-project/easy-extends-bundle": "~2.1#dev",
"sonata-project/intl-bundle": "2.2.x-dev",
"knplabs/knp-paginator-bundle": "dev-master",
"knplabs/knp-time-bundle": "dev-master",
"knplabs/knp-menu-bundle": "1.1.*",
"jms/serializer-bundle": "0.13.*#dev"
},
So I fixed, it should be:
"friendsofsymfony/user-bundle": "~2.0#dev"
not
"friendsofsymfony/user-bundle ": "~2.0#dev"

Composer behind proxy not working for symfony project

In my workplace network we have to use a proxy. I want to use Composer a to download some package dependencies for my Symfony2 projects. It does not work even after declaring the environment variable with the proxy information. I noticed that we are also unable to revolve any external name using the DNS of the company. And I think that one is the main problem that does not alow us to download with composer.
The truth is that I can not change any thing on those servers or policies of the company.
Do you think that I can do something that can let me resolve those names or access those resources to install the dependencies?
this is the error:
The "http://thirds.packagist.dev/packages.json" file could not be downloaded (HTTP/1.0 503 Service Unavailable)
http://thirds.packagist.dev could not be fully loaded, package information was loaded from the local cache and may be out of date
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. O
penSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
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]
Then the composer.json file is this one:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"repositories": [
{
"type": "composer",
"url": "http://thirds.packagist.dev"
}
],
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "1.3.4",
"sylius/resource-bundle": "*",
"friendsofsymfony/jsrouting-bundle": "*",
"genemu/form-bundle": "2.2.*"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}
Adding composer diag:
root#zeus:/home/abel/Documents/http/team# php composer.phar diag
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
Checking HTTP proxy: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: FAIL
Unable to assert the situation, maybe github is down (The "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0" file could not be downloaded: Peer certificate CN=`*.github.com' did not match expected CN=`201.220.215.11'
failed to open stream: Cannot connect to HTTPS server through proxy)
Checking composer.json: OK
Checking disk free space: OK
Checking composer version:
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenS
SL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
failed to open stream: Cannot connect to HTTPS server through proxy
diagnose
root#zeus:/home/abel/Documents/http/team#
Also I tried to declared the ip of packagist.org on my etc hosts... and then i notices that the DNS that is used is not the one of my localhost:
root#zeus:/home/abel/Documents/http/team# php composer.phar update
Loading composer repositories with package information
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection t
imed out
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]
root#zeus:/home/abel/Documents/http/team# cat /etc/hosts
127.0.0.1 localhost
201.220.207.218 zeus.ltu.sld.cu zeus
127.0.0.1 thirds.packagist.dev
127.0.0.1 abel.ltu.sld.cu
87.98.253.214 packagist.org
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root#zeus:/home/abel/Documents/http/team#
I once faced the same issue, and setting the proxy in my terminal solved the problem.
If you're using Windows, enter these commands :
set HTTP_PROXY=http://user:password#proxy.domain.com:port
set HTTPS_PROXY=http://user:password#proxy.domain.com:port
In Unix system, the command is export instead of set.
Then you can run composer update command.
If you still have problems, it might be git that needs the proxy configuration too.
In your %HOMEPATH%\.gitconfig, add the following :
[http]
proxy = http://user:password#proxy.domain.com:port
EDIT:
Since you've added the results of composer diag, the problem seems to be that your proxy doesn't handle the request_fulluri flag for HTTPS requests.
You can disable this option by setting the environment variable HTTPS_PROXY_REQUEST_FULLURI like this (Unix system) :
set HTTPS_PROXY_REQUEST_FULLURI=0

Resources