I tried to update Composer via:composer self-update
but it encounter the Composer\Downloader\TransportException
here is what I've got from composer self-update --verbose andphp -d "apc.enable_cli=0" composer.phar self-update --verbose
Updating to version .
Downloading: 100%
[Composer\Downloader\TransportException]
"https://getcomposer.org/composer.phar" appears broken, and returned an empty 200 response
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:192
Composer\Util\RemoteFilesystem->get() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:62
Composer\Util\RemoteFilesystem->copy() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/SelfUpdateCommand.php:73
Composer\Command\SelfUpdateCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:117
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:15
self-update
I finally find out what's the problem.
as I connecting to internet through proxy server so composer must be configured first and as iconoclast explained in PHP Composer behind http proxy I tried to add this variables to system environment path(of cource on windows):
HTTP_PROXY(value = my.proxy.address:port)
HTTPS_PROXY(value = my.proxy.address:port)
HTTP_PROXY_REQUEST_FULLURI(value = 0)
HTTPS_PROXY_REQUEST_FULLURI(value = 0)
But after setting the last 2 variable these 2 tests in composer diag encountered with errors:
Checking HTTP proxy support for request_fulluri
Checking HTTPS proxy support for request_fulluri
finally by removing them and restarting my PC all of the scenario went on as it assumed to go.;)
BTW thanks for your support
Related
I have a script that is meant to send a comment on a differential revision and is meant to update harbour master on whether the CI build was successful. Lately I've been receiving the following error:
PCNTL [49m[m Unable to install signal handler, pcntl_signal() unavailable. Continuing without signal handling.
[2022-11-10 11:34:30] EXCEPTION: (Exception) Failed to s
I've tried PHP version 8.1 and 5.6 no luck.
Does anyone know a solution? Much appriated.
Full log:
[Pipeline] sh
echo '{"transactions":[{"type":"comment","value":"failed: http://jenkins.lab.local:8080/job/Lemington_build/685/"}],"objectIdentifier":"D43951"}'
arc --trace --conduit-token <secret_token> --conduit-uri http://phabricator.lab.local/ call-conduit differential.revision.edit
[1m[45m ARGV [49m[m "C:/Program Files/Arcanist/arcanist/bin/arc" --trace --conduit-token <secret_token> --conduit-uri http://phabricator.lab.local/ call-conduit differential.revision.edit
[1m[45m PCNTL [49m[m Unable to install signal handler, pcntl_signal() unavailable. Continuing without signal handling.
[2022-11-10 11:34:30] EXCEPTION: (Exception) Failed to set socket nonblocking! at [<arcanist>\src\channel\PhutilSocketChannel.php:51]
arcanist(head=master, ref.master=85c953ebe4a6)
#0 PhutilSocketChannel::__construct(resource) called at [<arcanist>\src\workflow\ArcanistWorkflow.php:2414]
#1 ArcanistWorkflow::readStdin() called at [<arcanist>\src\workflow\ArcanistCallConduitWorkflow.php:46]
#2 ArcanistCallConduitWorkflow::runWorkflow(PhutilArgumentParser) called at [<arcanist>\src\workflow\ArcanistWorkflow.php:227]
#3 ArcanistWorkflow::executeWorkflow(PhutilArgumentParser) called at [<arcanist>\src\toolset\ArcanistPhutilWorkflow.php:21]
#4 ArcanistPhutilWorkflow::execute(PhutilArgumentParser) called at [<arcanist>\src\parser\argument\PhutilArgumentParser.php:492]
#5 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>\src\runtime\ArcanistRuntime.php:171]
#6 ArcanistRuntime::executeCore(array) called at [<arcanist>\src\runtime\ArcanistRuntime.php:37]
#7 ArcanistRuntime::execute(array) called at [<arcanist>\support\init\init-arcanist.php:6]
#8 require_once(string) called at [<arcanist>\bin\arc:10]
I've tried PHP version 8.1 and 5.6 no luck.
Also tried the arc upgrade command but I'm on latest version
You are getting this error because your local version of PHP must not be compiled with pcntl_signal
You can check if it is supported with the following command
php -i | grep pcntl
Which should result in
pcntl
pcntl support => enabled
This link in the PHP Manual is the instructions for installation - https://www.php.net/manual/en/pcntl.installation.php
My current version of Shopware has a small problem, for which I'd like to implement the following patch:
https://gitlab.com/mh2017/shopware6-patches/-/raw/master/core/variant-listing-updater.patch
To implement this patch I am using the cweagans/composer-patches plug-in. When running composer update the Shopware Core is attempted to be removed and re-installed:
Gathering patches for root package.
Removing package shopware/core so that it can be re-installed and re-patched.
- Removing shopware/core (6.4.7.0)
However the removal of the Core fails, as the update command fails:
> [ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:prepare
ErrorException {#7
#message: "Warning: include(/var/www/html/vendor/composer/../shopware/core/Framework/Plugin/KernelPluginLoader/StaticKernelPluginLoader.php): failed to open stream: No such file or directory"
#code: 0
#file: "./vendor/symfony/error-handler/DebugClassLoader.php"
#line: 349
#severity: E_WARNING
trace: {
./vendor/symfony/error-handler/DebugClassLoader.php:349 { …}
./bin/console:49 {
›
› $pluginLoader = new StaticKernelPluginLoader($classLoader, null);
›
}
}
}
Script [ ! -f vendor/autoload.php ] || $PHP_BINARY bin/console system:update:prepare handling the pre-update-cmd event returned with error code 255
This seems to be due to the fact that the core isn't there when attempting to run this command. When attempting to run this with the --no-scripts command, the command does run but also does not patch the Shopware version (as it is also a script).
What would be the best way to apply patches to the Shopware core that also ensures that composer runs smoothly?
Write simple bash script like this and add it to composer script or run manually. I'm using this commands in my gitlab pipelines.
# apply commit
curl -o /tmp/NEXT-21468.patch https://github.com/shopware/platform/commit/285c5d4b6bf9f93f7ebfbbcb3354e95fb5adb6ee.patch
git apply -p3 --directory='vendor/shopware/core' < /tmp/NEXT-21468.patch
# use sed to replace case sensitive path
curl -o /tmp/NEXT-20216.patch https://github.com/shopware/platform/commit/bec6ac21a78ab84c7181dac2347e3e670f92033c.patch
sed -i 's|/src/Core/|/src/core/|g' /tmp/NEXT-20216.patch
sed -i 's|/src/Storefront/|/src/storefront/|g' /tmp/NEXT-20216.patch
git apply -p2 --directory='vendor/shopware' < /tmp/NEXT-20216.patch
# apply pull request
curl -o /tmp/NEXT-21994.patch https://patch-diff.githubusercontent.com/raw/shopware/platform/pull/2536.patch
git apply -p3 --directory='vendor/shopware/core' < /tmp/NEXT-21994.patch
I updated the language of my question, because the original question seemed to be worded in a confusing way (evident from downvotes and unhelpful comments). Hope this makes more sense.
Hi, I'm trying to upgrade the PHP version on a site, I followed this thread and it worked nicely on my development site - I basically changed all instance of PHP "7.1" in the trellis directory to "7.4", and required a PHP version of at least 7.4 in composer and ran composer update.
I happily pushed the update to the staging site, but when I attempted to provision the server with ansible-playbook server.yml -e env=staging, I received the following error:
TASK [Install Python 2.x] ************************************************************************************* ***********************************
System info:
Ansible 2.3.0.0; Linux
Trellis at "Update PHP from 7.1 to 7.4"
---------------------------------------------------
Shared connection to 107.170.41.149 closed.
fatal: [107.170.41.149]: FAILED! => {"changed": false, "failed": true, "rc": 100, "stderr": "Shared connection to 107.170.41.149 closed.\r\n", "stdout": "/usr/bin/python\r\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).\r\n", "stdout_lines": ["/usr/bin/python", "E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."]}
Ansible seems to be getting stuck on the "Install Python 2." task. The staging server cannot be provisioned, and when I run php -v on the server it says it's running PHP 7.2.
How do I update PHP? I am avoiding doing it manually, because my gut's telling me there's a special roots way.
The server in question is Ubuntu 16.04 running PHP 7.2 (as mentioned above).
Below is the verbose output of the error from provisioning the staging server:
System info:
Ansible 2.3.0.0; Linux
Trellis at "Update PHP from 7.1 to 7.4"
---------------------------------------------------
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/jill/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 16490
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 100
Shared connection to 107.170.41.149 closed.
fatal: [107.170.41.149]: FAILED! => {
"changed": false,
"failed": true,
"rc": 100,
"stderr": "OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017\r\ndebug1: Reading configuration data /home/jill/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 16490\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 100\r\nShared connection to 107.170.41.149 closed.\r\n",
"stdout": "/usr/bin/python\r\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).\r\n",
"stdout_lines": [
"/usr/bin/python",
"E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."
]
}
This is neither a PHP composer nor a Python problem nor an Ansible problem. The underlying operating system (Ubuntu) has a problem with its apt libraries. The error comes from APT. Sadly you didn't tell us, what ansible module you use in the task named "Install Python 2.x".
Try 'apt-get -f install' with no packages
I think, some package installations hang on the system and need to be installed or configured. This may not have anything to do with your current job of upgrading PHP. Something went wrong in the past. APT will continue to stop operating til this issue is solved. Normally you would do it manually and have a look at the output of apt-get -f install to get an advice of what is the problem with that system. I think it will try to fix the issue automatically or throw an error what is the real issue (for example with two packages that cannot be installed at the same time or a file or directory that is missing or contains wrong values).
This is nothing "normal" which should happen all the time, when you update 100 hosts. This is very specific and part of the so called "configuration gap". Of course -if you dont want to login manually- you can ignore that error in your playbook task, but register the result, if the task failes, check, if the error messages in the registered var contains the above message in stderr and call a command module in your playbook. This would be a little bit of "self-healing".
Something like this
- package:
name: "..."
ignore_errors: true
register: installation
- shell: "apt -f install"
register: self_healing
when:
- "installation is failed"
- "'apt -f install' in installation.stderr"
- debug:
var: self_healing
when: "self_healing is defined"
i use the new feature of gitlab the composer package registry.
It works fine but the authentication with the auth.json file dont work.
I done all steps in the documentation of gitlab and composer but no success.
I tried to store the auth.json file beside the composer.json file and at %APPDATA%/Composer but it makes no different. I get allways the same error message.
https://docs.gitlab.com/ee/user/packages/composer_repository/
https://getcomposer.org/doc/articles/http-basic-authentication.md
If i use the inline authentication in the composer.json file at the repository object it works.
{"repositories": [{"type": "composer", "url": "https://extremely:secret#repo.example.org"}]}
I get following error message:
C:\path\to\project> composer update -vvv
Reading ./composer.json
Loading config file ./composer.json
Loading config file C:\path\to\project/auth.json
Reading C:\path\to\project/auth.json
Checked CA file C:\Users\user\AppData\Local\Temp\opeD84C.tmp: valid
Executing command (C:\path\to\project\ida.argo.data): git branch --no-color --no-abbrev -v
Reading C:/Users/user/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/user/AppData/Roaming/Composer/composer.json
Running 1.10.10 (2020-08-03 11:35:19) with PHP 7.4.8 on Windows NT / 10.0
Loading composer repositories with package information
Downloading https://gitlab.com/api/v4/group/8835906/-/packages/composer/packages.json
[Composer\Downloader\TransportException]
The "https://gitlab.com/api/v4/group/8835906/-/packages/composer/packages.json" file could not be downloaded (HTTP/
1.1 404 Not Found)
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:441
Composer\Util\RemoteFilesystem->get() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:105
Composer\Util\RemoteFilesystem->getContents() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:695
Composer\Repository\ComposerRepository->fetchFile() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:506
Composer\Repository\ComposerRepository->loadRootServerFile() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:285
Composer\Repository\ComposerRepository->hasProviders() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:108
Composer\DependencyResolver\Pool->addRepository() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:393
Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:232
Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/UpdateCommand.php:163
Composer\Command\UpdateCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:281
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:113
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:61
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24
I hope someone can help me :) thx!
Gitlab updated his documentation.
https://docs.gitlab.com/ee/user/packages/composer_repository/index.html
You must use the gitlab-token configuration in the auth.json.
{
"gitlab-token": {
"gitlab.com": "<personal_access_token>"
}
}
To elaborate on Arth's answer and for people ending up here who followed the Gitlab directions, but use a different port for a (local) gitlab server: add the port to the different configs.
composer.json
"config": {
"gitlab-domains": [
"<your gitlab domain>:<custom port>"
]
},
auth.json
{
"gitlab-token": {
"<your gitlab domain>:<custom port>": "<personal_access_token>"
}
}
That got it working for me.
Try to edit:
/home/{USER}/.config/composer/auth.json file
I'm trying to use bitBucket Pipeline with a Laravel. But everytime that run the pipeline return the follow error:
> post-install-cmd: Illuminate\Foundation\ComposerScripts::postInstall
> post-install-cmd: php artisan optimize --verbose
Generating optimized class loader
Compiling common classes
Script php artisan optimize --verbose handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:196
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:94
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:350
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:134
Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:838
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
require() at /usr/local/bin/composer:25
bitbucket-pipelines.yml:
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: phpunit/phpunit:5.0.3
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- composer install --verbose
The problem was solved, I needed to set some environments variable.
To be more specific, I use a collect errors' service called rollbar (really good by the way)
And in config/services.php it was setted like that:
'rollbar' => [
'access_token' => env('ROLLBAR_ACCESS_TOKEN'),
'level' => env('ROLLBAR_LEVEL', 'error'),
],
I just needed to set ROLLBAR_ACCESS_TOKEN variable in Settings/PIPELINES/Environment variables on BitBucket