Installing Yii2 with composer [ErrorException] Undefined index - composer-php

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

Related

Why error installing L5-Swagger in laravel 6 app?

I have laravel 6 backend rest api app and I want to create Swagger docs for add I found
https://github.com/DarkaOnLine/L5-Swagger
plugin which I suppose could use usefull creating Swagger docs
But I encountered erros publishing config. I suppose I really need this step.
$ php artisan --version
Laravel Framework 6.13.1
serge#athoe:/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI$ composer require "darkaonline/l5-swagger"
Using version ^6.0 for darkaonline/l5-swagger
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
- Installing symfony/yaml (v4.4.4): Downloading (100%)
- Installing swagger-api/swagger-ui (v3.25.0): Downloading (100%)
- Installing doctrine/annotations (v1.8.0): Downloading (100%)
- Installing zircote/swagger-php (3.0.3): Downloading (100%)
- Installing darkaonline/l5-swagger (6.0.3): Downloading (100%)
darkaonline/l5-swagger suggests installing zircote/swagger-php:~2.0 (!!! Require Swagger-PHP ~2.0 for #SWG annotations support !!!)
Package anahkiasen/underscore-php is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating optimized autoload files
Warning: Ambiguous class resolution, "App\library\ChunkReadFilter" was found in both "/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/app/library/importBoxRooms.php" and "/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/app/library/importTasks.php", the first will be used.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
Discovered Package: barryvdh/laravel-cors
Discovered Package: barryvdh/laravel-ide-helper
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: cviebrock/eloquent-sluggable
Discovered Package: darkaonline/l5-swagger
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/tinker
Discovered Package: laravolt/avatar
Discovered Package: maatwebsite/excel
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: orangehill/iseed
Discovered Package: spatie/laravel-activitylog
Discovered Package: spatie/laravel-image-optimizer
Discovered Package: tymon/jwt-auth
Package manifest generated successfully.
serge#athoe:/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI$ php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
Copied File [/vendor/darkaonline/l5-swagger/config/l5-swagger.php] To [/config/l5-swagger.php]
League\Flysystem\Exception : Impossible to create the root directory "".
at /mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/league/flysystem/src/Adapter/Local.php:112
108| clearstatcache(false, $root);
109|
110| if ( ! is_dir($root)) {
111| $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';
> 112| throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage));
113| }
114| }
115| }
116|
Exception trace:
1 League\Flysystem\Adapter\Local::ensureDirectory()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/league/flysystem/src/Adapter/Local.php:78
2 League\Flysystem\Adapter\Local::__construct()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php:235
Please use the argument -v to see more details.
serge#athoe:/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI$ php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider" -v
League\Flysystem\Exception : Impossible to create the root directory "".
at /mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/league/flysystem/src/Adapter/Local.php:112
108| clearstatcache(false, $root);
109|
110| if ( ! is_dir($root)) {
111| $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';
> 112| throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage));
113| }
114| }
115| }
116|
Exception trace:
1 League\Flysystem\Adapter\Local::ensureDirectory()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/league/flysystem/src/Adapter/Local.php:78
2 League\Flysystem\Adapter\Local::__construct()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php:235
3 Illuminate\Foundation\Console\VendorPublishCommand::publishDirectory("/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/darkaonline/l5-swagger/src/../resources/views")
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php:200
4 Illuminate\Foundation\Console\VendorPublishCommand::publishItem("/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/darkaonline/l5-swagger/src/../resources/views")
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php:163
5 Illuminate\Foundation\Console\VendorPublishCommand::publishTag()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php:76
6 Illuminate\Foundation\Console\VendorPublishCommand::handle()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
7 call_user_func_array([])
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
8 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/Util.php:36
9 Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90
10 Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34
11 Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Container/Container.php:590
12 Illuminate\Container\Container::call()
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Console/Command.php:201
13 Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/symfony/console/Command/Command.php:255
14 Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Console/Command.php:188
15 Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/symfony/console/Application.php:1012
16 Symfony\Component\Console\Application::doRunCommand(Object(Illuminate\Foundation\Console\VendorPublishCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/symfony/console/Application.php:272
17 Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/symfony/console/Application.php:148
18 Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
19 Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:131
20 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
/mnt/_work_sdb8/wwwroot/lar/CTasksRestAPI/artisan:37
Googling for decision I tried run :
chown -R www-data:root .
But it did not help.
also I do not have any problems with settging other plugins, configurations.
How fix it ?
Thanks!
As far as I see from your stack trace, the command fails to create a views directory (./resources/views/vendor/l5-swagger).
Note: chown -R www-data:root . - this command can create some new problems..
After that command, owner is www-data (but you start artisan commands as serge).
After that command, group is root (but serge may not be part of that group).
You have to verify that your user (serge) has proper permissions there (./resources/views, ./resources/views/vendor).
To check current permissions run: ls -la ./resources, ls -la ./resources/views, and ls -la ./resources/views/vendor (if vendor exists already)
Maybe you need something like: sudo chmod -R serge.www-data (serge - owner, www-data - group)
However, it mostly depends on your specific setup and desired result.

Composer update - connection timed out

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"

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

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}()
...

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