Composer update - connection timed out - composer-php

In my composer.json I updated the following line:
"require": {
"<x>/<y>" : "dev-<newBranch>"
}
When I call composer update <x>/<y> I get this error:
The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out`
The the given URL is accessible from my browser without any problem.
The package and branch are available on packagist.
Output composer update <x>/<y> -vv
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:550
Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:682
Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:497
Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:276
Composer\Repository\ComposerRepository->hasProviders() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:99
Composer\DependencyResolver\Pool->addRepository() at phar:///usr/local/bin/composer/src/Composer/Installer.php:378
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:228
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:162
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:241
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:254
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:103
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:56
require() at /usr/local/bin/composer:24
This appeared after calling: composer clearcache

Without fully understanding it, this solved the issue:
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

Related

Composer Update with Laravel 5.4 & PHP 7 "Class Name must be a valid object or a string"

So there are a few threads on this but none with exactly the same issue. Basically I upgraded to php 5.4 from 5.1 and php 7 from 5.6 and I am now getting this error message.
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
The reason this seems weird to me is the error is in the actual laravel files not in my app / something I have edited. This error happens when I run composer update or whenever I try and visit any of my webpages. Below is a full dump from composer update, any ideas?
[root#dev1 dev1]# composer update
> php artisan clear-compiled
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'Symfony\\Compone...')
#1 /var/www/dev1/bootstrap/cache/compiled.php(6207): call_user_func(Object(Closure), 0, 'Symfony\\Compone...')
#2 /var/www/dev1/bootstrap/cache/compiled.php(12223): Illuminate\Support\Arr::first(Array, Object(Closure), NULL)
#3 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(97): Illuminate\Support\Collection->first(Object(Closure))
#4 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(ReflectionException))
#5 /var/www/dev1/app/Exceptions/Handler.php(33): Illuminate\Foundation\Exceptions\Handler->report(Object(ReflectionException))
#6 /var/www/dev1/vendor/laravel/fram in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 96
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255
I've got a similar error when upgrading to Laravel 5.4. The problem is that Laravel is still loading bootstrap/cache/compiled.php (even though it says it's not used by the framework anymore). Removing the file will solve your issue.
From the docs:
If it exists, you may delete the bootstrap/cache/compiled.php file. It is no longer used by the framework.
php artisan cache:clear
php artisan clear-compiled
sudo composer dump-autoload

Laravel nginx permission issue

I've installed laravel on nginx based on this tutorial
. when i run my server ip address a blank page appears.
this is nginx error log:
2016/09/15 12:40:59 [error] 2857#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)
#3 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)
#4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueEx...
PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
I did have the same problem with this command: php artisan storage:link, and I did resolved with the command sudo before the code. Like this:
'sudo php artisan storage:link'. I believe that if you use sudo you will no longer have this problem.

cloning laravel project (non-compound name 'App')

I'm clonning my laravel project from my repo, then I run composer install and then composer update. But I'm getting an error:
php artisan clear-compiled
[ErrorException] The
use statement with non-compound name 'App' has no effect
Script php artisan clear-compiled handling the pre-update-cmd event
returned with an error
[RuntimeException] Error Output:
I can't figure out why is this happening and google couldn't help me this time. This is the log, what more disturbs me is that I can composer update from another machine in which I pushed the firsts commits.
[2015-12-15 18:41:42] local.ERROR: exception 'ErrorException' with
message 'The use statement with non-compound name 'App' has no effect'
in /var/www/html/anuncios.com/app/Http/routes.php:3 Stack trace:
0 /var/www/html/anuncios.com/app/Providers/RouteServiceProvider.php(41):
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'The
use stateme...', '/var/www/html/a...', 3, Array)
1 /var/www/html/anuncios.com/app/Providers/RouteServiceProvider.php(41):
App\Providers\RouteServiceProvider::App\Providers{closure}()
...

Installing Yii2 with composer [ErrorException] Undefined index

1) Installed Composer on my Qnap NAS through Putty with the following command:
curl -sS -k https://getcomposer.org/installer | /mnt/ext/opt/apache/bin/php -d detect_unicode=Off
2) Updated composer:
/mnt/ext/opt/apache/bin/php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta4"
3) Installed Yii2:
/mnt/ext/opt/apache/bin/php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.3
The advanced folder has been created but without the vendor folder. Composer gives the following error:
Loading composer repositories with package information
Updating dependencies (including require-dev)
[ErrorException] Undefined index: owner
Update
Error with -vvv
Exception trace:
() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Repository/Vcs/GitHubDriver.php:409
Composer\Util\ErrorHandler::handle() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Repository/Vcs/GitHubDriver.php:409
Composer\Repository\Vcs\GitHubDriver->fetchRootIdentifier() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Repository/Vcs/GitHubDriver.php:61
Composer\Repository\Vcs\GitHubDriver->initialize() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Repository/VcsRepository.php:86
Composer\Repository\VcsRepository->getDriver() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetVcsRepository.php:118
Fxp\Composer\AssetPlugin\Repository\AbstractAssetVcsRepository->initDriver() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:38
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initialize() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Repository/ArrayRepository.php:170
Composer\Repository\ArrayRepository->getPackages() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/Pool.php:104
Composer\DependencyResolver\Pool->addRepository() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:58
Fxp\Composer\AssetPlugin\Repository\Util::addRepositoryInstance() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:39
Fxp\Composer\AssetPlugin\Repository\Util::addRepository() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:139
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/Pool.php:191
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/Pool.php:180
Composer\DependencyResolver\Pool->whatProvides() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:161
Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:273
Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:324
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/DependencyResolver/Solver.php:172
Composer\DependencyResolver\Solver->solve() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Installer.php:505
Composer\Installer->doInstall() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Installer.php:230
Composer\Installer->run() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Command/UpdateCommand.php:140
Composer\Command\UpdateCommand->execute() at phar:///share/MD0_DATA/Web/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///share/MD0_DATA/Web/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///share/MD0_DATA/Web/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Console/Application.php:146
Composer\Console\Application->doRun() at phar:///share/MD0_DATA/Web/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///share/MD0_DATA/Web/composer.phar/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar:///share/MD0_DATA/Web/composer.phar/bin/composer:43
require() at /share/MD0_DATA/Web/composer.phar:25

Newly installed magento error on Call to a member function setParent() - nginx

Newly Installed Magento not working because of the following error. i'm using php5-fpm and nginx.
Searching the web shows that the error probably has a problem with php-dom and simplexml, i already re-installed them and updated to the latest version but the site still does not work.
I never seen the front page and backend after the installation wizard completed.
TIA
013/07/26 23:02:09 [error] 870#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Call to a member function setParent() on a non-object in /var/www/staging.site.com/lib/Varien/Simplexml/Element.php on line 440
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /var/www/staging.site.com/index.php:0
PHP message: PHP 2. Mage::run() /var/www/staging.site.com/index.php:87
PHP message: PHP 3. Mage_Core_Model_App->run() /var/www/staging.site.com/app/Mage.php:683
PHP message: PHP 4. Mage_Core_Model_App->_initModules() /var/www/staging.site.com/app/code/core/Mage/Core/Model/App.php:343
PHP message: PHP 5. Mage_Core_Model_Config->loadDb() /var/www/staging.site.com/app/code/core/Mage/Core/Model/App.php:420
PHP message: PHP 6. Mage_Core_Model_Resource_Config->loadToXml() /var/www/staging.site.com/app/code/core/Mage/Core/Model/Config.php:354
PHP message: PHP 7. Varien_Simplexml_Element->extend() /var/www/staging.site.com/app/code/core/Mage/Core/Model/Resource/Config.php:112
PHP message: PHP 8. Varien_Simplexml_Element->extendChild() /var/www/staging.site.com/lib/Varien/Simplexml/Element.php:387" while reading response header from upstream, client: 112.198.90.162, server: staging.site.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "staging.site.com"

Resources